Strange behaviour with script files and %S in parameters

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Strange behaviour with script files and %S in parameters

Post by *nsp »

Context :
I have a script file called doStuff.vbs in folder C:\WITH SPACE

If i create a button like :
Command: C:\WITH SPACE\doStruff.vbs
Parameters: %P%N %T%N

Everything is OK


If i change parameter to
Parameters: %S

I Got an error :no file extension for "C:\WITH" coming from Windows Scripting host....

It seems that ahk, autoit, powerpro scripts are also not called as expected. But bat, cmd file are called successfully ????
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Try putting the command itself in double quotes "". While TC adds them automatically for parameters, it doesn't add them for the program itself. TC uses a different function (CreateProcess) for %S than for %P%N to launch files (ShellExecuteEx), because CreateProcess supports much longer command lines up to 32kBytes. CreateProcess is more sensitive to missing double quotes than ShellExecuteEx.
Author of Total Commander
https://www.ghisler.com
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

ghisler(Author) wrote:Try putting the command itself in double quotes "". While TC adds them automatically for parameters, it doesn't add them for the program itself. TC uses a different function (CreateProcess) for %S than for %P%N to launch files (ShellExecuteEx), because CreateProcess supports much longer command lines up to 32kBytes. CreateProcess is more sensitive to missing double quotes than ShellExecuteEx.
If i set "Mycmd.vbs" in program, I have the same behaviour.
If i set ""Mycmd.vbs"" in program, I have file not found from tc.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strange, I will try to reproduce it.
Author of Total Commander
https://www.ghisler.com
Post Reply