%S Paramter let VBS SCRIPT CRASH OR NOT EVEN EXECUTE
Moderators: white, Hacker, petermad, Stefan2
%S Paramter let VBS SCRIPT CRASH OR NOT EVEN EXECUTE
Hello
It seems if the vbs script name have a space the parameter %S crash it (seems it dont even execute the code)
Example make vbs file type inside MsgBox "Hello Wold" thats all, save it under "test doh" (name or path must contain a space) now execute it with params like %N %L works fine... and if you try %S
ERROR:
"C:\test" have no file extension
It seems there is a parsing problem but only if you use %S I guess TC makes it but maybe its also windows 10 x64...
It seems if the vbs script name have a space the parameter %S crash it (seems it dont even execute the code)
Example make vbs file type inside MsgBox "Hello Wold" thats all, save it under "test doh" (name or path must contain a space) now execute it with params like %N %L works fine... and if you try %S
ERROR:
"C:\test" have no file extension
It seems there is a parsing problem but only if you use %S I guess TC makes it but maybe its also windows 10 x64...
Confirmed! (W7 x64, TC 8.52a x64&x86)
1) With empty Parameter field always okay:
Command field:
A)
B)
C)
2) with Parameter field: both version A) and B) failed with: C) is okay.
3) Interesting: there is no problem if you use Parameter field:
Registry association for default Open command:
Regards
Holger
1) With empty Parameter field always okay:
Command field:
A)
Code: Select all
C:\test\Test Script.vbs
Code: Select all
"C:\test\Test Script.vbs"
Code: Select all
wscript "C:\test\Test Script.vbs"
Code: Select all
%S
Code: Select all
---------------------------
Windows Script Host
---------------------------
There is no file extension in "C:\test\Test".
---------------------------
OK
---------------------------
3) Interesting: there is no problem if you use Parameter field:
Code: Select all
"%L"
Code: Select all
\\\Registry\HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command\
(Default) REG_EXPAND_SZ "%SystemRoot%\System32\WScript.exe" "%1" %*
Holger
In Process Explorer you can see that TC doesn't use any quotes, or - even worse - removes them from the command line field, when %S is used in the parameter field. I doubt this is intended behavior. The process command line is correctly quoted when %S is removed from the parameters field.
2Prana
Please be more accurate next time. There's no crash at all.
Regards
Dalai
2Prana
Please be more accurate next time. There's no crash at all.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
How many files are selected? Maybe the command line becomes too long for vbs to handle?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
Huh? Please try it and look at the process command line of wscript.exe before confirming its error message. You'll see that there are no quotes at all, which is just wrong.
Regards
Dalai
Huh? Please try it and look at the process command line of wscript.exe before confirming its error message. You'll see that there are no quotes at all, which is just wrong.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
This bug is still not fixed in TC9 beta3.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It must be a VBScript bug then - it probably has problems when command lines become too long (buffer overflow?). I guess that only Microsoft can fix that.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
The command line is NOT too long! I only select none or one file/directory at most. Just open Process Explorer and compare the command lines you get with buttonand this oneusing this VBS (or any other):
You'll see that it doesn't matter how many objects you select before clicking the button. The issue here is that TC doesn't use quotes, and even worse, it removes them from the button where they're explicitly set! TC does this only when %S is used in the parameters field!
Regards
Dalai
Code: Select all
TOTALCMD#BAR#DATA
"C:\test with spaces.vbs"
%L %S
wcmicons.dll
0
-1
Code: Select all
TOTALCMD#BAR#DATA
"C:\test with spaces.vbs"
%L
wcmicons.dll
0
-1
Code: Select all
MsgBox "Hello World"
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
The commands in the command fields of both buttons I just posted are quoted, aren't they? So they're explicitly set, although they're not necessary in the command field. When using the first button you can see in Process Explorer that the command launched by TC does not contain any quotes, neither around wscript.exe nor the vbs file or anywhere else.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Here's an image that shows the command line of wscript.exe in Process Explorer when the following button was clicked:
The cursor was on the directory C:\a when the button was clicked.
Here's an image of this button (%S removed compared to first one):
TC's behavior is a problem because such buttons are created by TC itself when you drag a VBS script onto the button bar and add %S to the parameter field afterwards.
I hope it's clear now that TC's behavior is just wrong.
Regards
Dalai
Code: Select all
TOTALCMD#BAR#DATA
"c:\test with spaces.vbs"
%L %S
C:\Windows\System32\WScript.exe,2
test with spaces
c:\
0
-1
Here's an image of this button (%S removed compared to first one):
Code: Select all
TOTALCMD#BAR#DATA
"c:\test with spaces.vbs"
%L
C:\Windows\System32\WScript.exe,2
test with spaces
c:\
-1
I hope it's clear now that TC's behavior is just wrong.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Just to make clear that this bug has NOTHING to do with VBS or its engine, I just tried with this AutoIt script:using this button:and TC behaves exactly the same, removing all quotes from the command line (taken from Process Explorer):
AutoIt can't open the script file, and shows an error message just like the VBS does. Removing %S from the parameter field works fine, just like with the VBS.
Regards
Dalai
Code: Select all
MsgBox(0, "", "Hello World")
Code: Select all
TOTALCMD#BAR#DATA
"C:\test with spaces.au3"
%L %S
D:\Programme\AutoIt3.122\Icons\filetype1.ico
test with spaces
0
-1
Code: Select all
D:\Programme\AutoIt3\AutoIt3.exe C:\test with spaces.au3 D:\DOKUME~1\Dalai\LOKALE~1\Temp\CMD2103.tmp Boot
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror