Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Environment variables specifications are not expand/evaluated in shortcuts before execution #14410

Closed
clackwell opened this issue Jan 9, 2024 · 2 comments · Fixed by #14425
Labels
good first issue Good issue for new contributors to get started with

Comments

@clackwell
Copy link

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:"

295237396-ca228625-72c0-4b83-a6d2-83cf87b655a9

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:

295239103-471f988b-9a2c-4061-a7ba-0e0e418f67e2

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

  1. Create a shortcut and in its properties set/change its "Target:" field to:

%WINDIR%\notepad.exe

  1. Double click the shortcut in File Explorer.

Expected and actual result: Notepad(.exe) launches.

  1. Double lick the shortcut in Files.

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

@clackwell clackwell added the bug label Jan 9, 2024
@yaira2
Copy link
Member

yaira2 commented Jan 9, 2024

Thanks for the report

@yaira2 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
@yaira2 yaira2 added the good first issue Good issue for new contributors to get started with label Jan 9, 2024
@yaira2 yaira2 moved this from 🆕 New to 🔖 Ready to build in Files task board Jan 9, 2024
@github-project-automation github-project-automation bot moved this from 🔖 Ready to build to ✅ Done in Files task board Jan 12, 2024
@yaira2
Copy link
Member

yaira2 commented Jan 12, 2024

This issue should be resolved in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for new contributors to get started with
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants