Skip to content

Installer does not find schtasks if NoDefaultCurrentDirectoryInExePath=1 #2319

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.23.0.windows.1
cpu: x86_64
built from commit: 4db2e5cc9e1522131a039cbad3970f147a39f0ce
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

Windows 7 Professional SP1 64-bit

$ cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
$ cat /etc/install-options.txt

Editor Option: Nano
Custom Editor Path:
Path Option: Cmd
Plink Path: C:\Program Files\PuTTY\plink.exe
SSH Option: Plink
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Disabled
Enable Symlinks: Disabled
Enable Builtin Interactive Add: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

The NoDefaultCurrentDirectoryInExePath value at HKEY_CURRENT_USER\Environment has type REG_SZ and data 1.

The Path value at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment starts with %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;. The type of that value is REG_EXPAND_SZ, which seems correct to me.

The Path value at HKEY_CURRENT_USER\Environment lists unrelated directories and has no percent signs in it. The type of that value is REG_SZ.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Not applicable. The error occurs during installation.

Double-click Git-2.23.0-64-bit.exe in Windows Explorer and select the options described above, plus "Check daily for Git for Windows updates".

  • What did you expect to occur after running these commands?

Installation succeeds without errors.

  • What actually happened instead?

An error message pops up:

---------------------------
Git 2.23.0 Setup
---------------------------
Line 2307: Unable to schedule the Git for Windows updater (output: , errors: 'schtasks' is not recognized as an internal or external command,

operable program or batch file.

).
---------------------------
OK   
---------------------------

I then click OK and installation continues.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Not applicable.

Process Monitor

Process Monitor shows that Git-2.23.0-64-bit.tmp starts C:\Windows\system32\cmd.exe with the command line "C:\Windows\system32\cmd.exe" /C schtasks /Create /F /TN "Git for Windows Updater" /XML "C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\auto-updater.xml" >"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\remove-autoupdate.log" 2>"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\remove-autoupdate.err" and with a Path environment variable whose value starts with literally %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;, rather than C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;. The cmd.exe process then tries to open C:\Windows\system32\%SystemRoot%\system32\ and fails.

When the Git-2.23.0-64-bit.tmp process starts, it gets a Path environment variable whose value correctly starts with C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;. It also starts several cmd.exe processes with this correct Path value, e.g. when it runs "C:\Windows\system32\cmd.exe" /C .\mingw64\bin\git.exe config --system "ssh.variant" "putty" >"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\config-set.out" 2>"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\config-set.err" (source?). However, the Path variable is already wrong when it runs "C:\Windows\system32\cmd.exe" /C .\mingw64\bin\git.exe config --system "core.editor" "nano.exe" >"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\config-set.out" 2>"C:\Users\Kalle\AppData\Local\Temp\is-6PE04.tmp\config-set.err" (source?).

The working directory of the cmd.exe process is C:\Windows\system32\, but because the environment also contains NoDefaultCurrentDirectoryInExePath=1, cmd.exe does not search that directory when it is not listed in PATH.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions