You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Windows shortcuts I can use, for example, "%USERPROFILE%" (a specification of an environment variable, supported in cmd.exe/batch files) in the shortcut fields "Target:" and "Start in:"
But when executing such a shortcut via double click in Files, one can see that the process gets launched with the environment specification as is, instead of evaluated. From Process Explorer:
The top entry is when launched from File Explorer.
The bottom entry is when launched from Files. Note the command line, which for the bottom entry still contains the environment variable placeholder.
I suspect that expansion of environment variable specifications may be functionality of the underlying Win32 (or so) API used.
When launching the shortcut in cmd.exe, the expansion happens. One could suspect that cmd.exe has extra functionality to achieve this however.
When using Python, and executes the shortcut via os.system(), the expand happens, too.
Steps To Reproduce
Create a shortcut and in its properties set/change its "Target:" field to:
%WINDIR%\notepad.exe
Double click the shortcut in File Explorer.
Expected and actual result: Notepad(.exe) launches.
yaira2
changed the title
Environment variables specifications are not expand/evaluated in shortcuts before execution
Bug: Environment variables specifications are not expand/evaluated in shortcuts before execution
Jan 9, 2024
Description
In Windows shortcuts I can use, for example, "%USERPROFILE%" (a specification of an environment variable, supported in cmd.exe/batch files) in the shortcut fields "Target:" and "Start in:"
But when executing such a shortcut via double click in Files, one can see that the process gets launched with the environment specification as is, instead of evaluated. From Process Explorer:
The top entry is when launched from File Explorer.
The bottom entry is when launched from Files. Note the command line, which for the bottom entry still contains the environment variable placeholder.
I suspect that expansion of environment variable specifications may be functionality of the underlying Win32 (or so) API used.
When launching the shortcut in cmd.exe, the expansion happens. One could suspect that cmd.exe has extra functionality to achieve this however.
When using Python, and executes the shortcut via os.system(), the expand happens, too.
Steps To Reproduce
%WINDIR%\notepad.exe
Expected and actual result: Notepad(.exe) launches.
Expected result: Notepad.exe launches.
Actual result: Notepad does not launch.
Requirements
Notepad.exe gets launched as expected.
Files Version
3.1.1
Windows Version
10.0.22631.2861
Log File
debug.log
The text was updated successfully, but these errors were encountered: