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
The Files app fails to find and launch programs if the path contains spaces and has parameters. Eg: running D:\Folder With Spaces\program.exe param from the address bar, Files tries to "execute" D:\Folder with params With Spaces\program.exe param. The program still fails to run even if we explicitly specify the filename using quotes like, "D:\Folder With Spaces\program.exe" param .
Steps To Reproduce
create a batch file named test script.bat with the follow script:
@echooffecho%*
execute the script with some parameters through the address bar, e.g.: test script.bat param. The script fails to run.
execute the script with quotes around the file name, e.g.: "test script.bat" param. The script fails to run.
Requirements
Expected outcome was that it should've been able to run when filename was explicitly specified with quotes. ("test script.bat" param)
I propose to check if the user provided " to avoid ambiguity. If the first character is a " we look for the next " and use that as the delimiter instead. If we cannot find the second " we use the whole input as fileName. This behavior should be consistent with how cmd handles spaces.
Here is a possible implementation.
privatestaticasyncTask<bool>LaunchApplicationFromPath(stringcurrentInput,stringworkingDir){currentInput= currentInput.TrimStart();varpositionOfDelimiter= currentInput.IndexOf(' ');if(currentInput.ElementAt(0)=='"')positionOfDelimiter= currentInput.IndexOf('"',1);// if no spaces or doesn't start with a '"'if(positionOfDelimiter==-1)positionOfDelimiter= currentInput.Length -1;positionOfDelimiter+=1;// include delimiter in fileNamevarfileName= currentInput.Substring(0, positionOfDelimiter);vararguments= currentInput.Substring(positionOfDelimiter);returnawait LaunchHelper.LaunchAppAsync(fileName, arguments, workingDir);}
Files Version
3.4.1.0 - Dev
Windows Version
10.0.22631.3593
Log File
(not required)
The text was updated successfully, but these errors were encountered:
Description
The Files app fails to find and launch programs if the path contains spaces and has parameters. Eg: running
D:\Folder With Spaces\program.exe param
from the address bar, Files tries to "execute"D:\Folder
with paramsWith Spaces\program.exe param
. The program still fails to run even if we explicitly specify the filename using quotes like,"D:\Folder With Spaces\program.exe" param
.Steps To Reproduce
test script.bat
with the follow script:test script.bat param
. The script fails to run."test script.bat" param
. The script fails to run.Requirements
Expected outcome was that it should've been able to run when filename was explicitly specified with quotes. (
"test script.bat" param
)This bug is caused by this part of the code,
Files/src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs
Lines 821 to 828 in 4b77a5a
I propose to check if the user provided
"
to avoid ambiguity. If the first character is a"
we look for the next"
and use that as the delimiter instead. If we cannot find the second"
we use the whole input asfileName
. This behavior should be consistent with howcmd
handles spaces.Here is a possible implementation.
Files Version
3.4.1.0 - Dev
Windows Version
10.0.22631.3593
Log File
(not required)
The text was updated successfully, but these errors were encountered: