%S Paramter let VBS SCRIPT CRASH OR NOT EVEN EXECUTE

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Prana
Junior Member
Junior Member
Posts: 18
Joined: 2004-06-05, 16:14 UTC

%S Paramter let VBS SCRIPT CRASH OR NOT EVEN EXECUTE

Post by *Prana »

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...
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

Can't confirm with Win7 and TC 8.52a x64. Working fine here. How you launch your script?
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Confirmed! (W7 x64, TC 8.52a x64&x86)

1) With empty Parameter field always okay:
Command field:
A)

Code: Select all

C:\test\Test Script.vbs
B)

Code: Select all

"C:\test\Test Script.vbs"
C)

Code: Select all

wscript "C:\test\Test Script.vbs"
2) with Parameter field:

Code: Select all

%S
both version A) and B) failed with:

Code: Select all

---------------------------
Windows Script Host
---------------------------
There is no file extension in "C:\test\Test".

---------------------------
OK   
---------------------------
C) is okay.

3) Interesting: there is no problem if you use Parameter field:

Code: Select all

"%L"
Registry association for default Open command:

Code: Select all

\\\Registry\HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command\
(Default) REG_EXPAND_SZ "%SystemRoot%\System32\WScript.exe" "%1" %*
Regards
Holger
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2HolgerK
Ok, now I can confirm this behavior too.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

How many files are selected? Maybe the command line becomes too long for vbs to handle?
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

ghisler(Author) wrote:How many files are selected?
Reproducible if none (file under cursor), one or two files are selected.
Definitely no limitation of the command line length.

Regards
Holger
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

This bug is still not fixed in TC9 beta3.

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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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 button

Code: Select all

TOTALCMD#BAR#DATA
"C:\test with spaces.vbs"
%L %S
wcmicons.dll


0
-1
and this one

Code: Select all

TOTALCMD#BAR#DATA
"C:\test with spaces.vbs"
%L
wcmicons.dll


0
-1
using this VBS (or any other):

Code: Select all

MsgBox "Hello World"
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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Where are they explicitly set?
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Here's an image that shows the command line of wscript.exe in Process Explorer when the following button was clicked:

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

Code: Select all

TOTALCMD#BAR#DATA
"c:\test with spaces.vbs"
%L
C:\Windows\System32\WScript.exe,2
test with spaces
c:\

-1
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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Just to make clear that this bug has NOTHING to do with VBS or its engine, I just tried with this AutoIt script:

Code: Select all

MsgBox(0, "", "Hello World")
using this button:

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
and TC behaves exactly the same, removing all quotes from the command line (taken from Process Explorer):

Code: Select all

D:\Programme\AutoIt3\AutoIt3.exe C:\test with spaces.au3 D:\DOKUME~1\Dalai\LOKALE~1\Temp\CMD2103.tmp Boot
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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply