Open tapyourbadge opened 3 years ago
This is interesting, @jaimecbernardo @mykhailopylyp I remember there were some quirks with program parameters when we first introduced this plugin. Can either of you recall if we had a tracking issue for this already? I can't seem to find it.
I think the previous issues were about the programs plugin, while this one seems to be specific to the shell plugin.
I have also come up against this. My workaround is to use the program runner (not sure of its proper name). With --
to separate the args, in case it's useful to anyone else.
E.g. SomeScript.bat
available in my path, I can run it with .SomeScript -- arg1
successfully. If using the shell runner, I have to add the extension or it doesn't work.
I.e. both of these work:
>SomeScript.bat arg1
.SomeScript -- arg1
Are you still experiencing this issue? /needinfo
Yes, this issue is still present.
If I have a .bat file called "foo.bat" then running >foo
and >foo.bat
work. If I want to call it with an argument like >foo myArg
then it throws "The system cannot find the file specified". Instead, you have to specify the extension like >foo.bat myArg
. In normal shells, you don't have to specify the .bat
in the filename.
ETA: this is only an issue when "Command execution" is set to "Find and run the executable file" which seems to be the default. I've changed to run in pwsh.exe and the issue is no longer present.
ETA2: with a bit more to go on, I've looked at the code and it looks like there's an easy fix to also consider .bat files here: https://github.com/microsoft/PowerToys/blob/main/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs#L391
Microsoft PowerToys version
0.45.0
Running as admin
Area(s) with issue?
PowerToys Run
Steps to reproduce
Execute a batch file from PowerToys Run when the execution command:
For example:
> MyScript foo
✔️ Expected Behavior
When entered into Windows Run, the batch file executes normally (and the arguments are passed as expected), regardless of whether the extension is included or not.
❌ Actual Behavior
The script fails to run at all:
It works as expected if the command includes the extension or does not include any arguments.
Other Software
It fails with any batch file, but I was testing using a simple shortcut script that runs
sync -r -e %~1
, flushing and ejecting the specified drive.I was attempting to execute it using the command
> eject d
in PowerToys Run, with>
as the direct activation command for the Shell plugin.