wshshell.run breaks when converted to .exe

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
kenthompson
Posts: 14
Joined: Fri Nov 13, 2009 12:41 am

wshshell.run breaks when converted to .exe

Post by kenthompson » Thu Nov 19, 2009 6:02 am

I have an hta I am attempting to convert to an exe with htaedit. Everything works fine, (wshshell.run on an hta runs ok) except I have a wshshell.run command to run a vbs file.
The exe seems to just unload the file structure into a temp file and everything that gets called is in the original folder hierarchy within the temp file.

Here is my run:
strCmdLine = strCurrentDirectory&"ReqLoader.vbs" strCmdLine = Chr(34)&strCmdLine&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassFolder&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strRelFolderName&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassRelease&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassProject&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassDoc&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassPlatform&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassCycles&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassModules&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strUserName&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassword&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strPassProductlist&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strDomain&Chr(34)strCmdLine = strCmdLine& " " & Chr(34)&strProject&Chr(34)

WshShell.Run (strCmdLine)

that works fine when using it as a straight hta, but when put in the exe it comes back with:
"The system cannot find the file specified"

I tried to play with the commas and such, I even took out all the parms I'm passing so it is just the straight file name. The file name looks good in the debugger locals, I can follow the path straight to the vbs doc, but the system can't find it.

any ideas on this?
any help will be appreciated.

User avatar
kenthompson
Posts: 14
Joined: Fri Nov 13, 2009 12:41 am

wshshell.run breaks when converted to .exe

Post by kenthompson » Thu Nov 19, 2009 6:34 am

I figured out the problem. The run line should have looked like this

WshShell.Run strCmdLine,1,false

I didn't have the switches before. I don't know why it worked as an hta without the switches, but it did. and now it works as an exe with the switches in there....

mysterious to me, but I'm sure there is an answer as to why.

Locked