Discussion:
issue on scripting syntax on x64
(too old to reply)
Tyler Durden
2009-06-08 14:45:05 UTC
Permalink
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory & "\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"

Any help would be appreciated.
Richard Mueller [MVP]
2009-06-08 15:15:24 UTC
Permalink
Post by Tyler Durden
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead of
relying on a working directory that may or may not be correct?
If you are certain the exe is in the specified subfolder of the folder where
the VBScript is saved, perhaps something similar to this would work better:
===========
Dim WSHShell, strCmd

Set WSHShell = CreateObject("WScript.Shell")
strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
Wscript.Echo strCmd
WSHShell.Run strCmd, 2
========
The statement to echo strCmd is for troubleshooting, to make sure the
command is correct. Note the path and file name are in quotes, and quotes in
a quoted string must be doubled.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Tyler Durden
2009-06-10 00:08:16 UTC
Permalink
on x32 still worked fine, could not test it on a x64 yet. would be possible
to do it without cmd.exe?

thank you!
Post by Richard Mueller [MVP]
Post by Tyler Durden
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
If you are certain the exe is in the specified subfolder of the folder
where the VBScript is saved, perhaps something similar to this would work
===========
Dim WSHShell, strCmd
Set WSHShell = CreateObject("WScript.Shell")
strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
Wscript.Echo strCmd
WSHShell.Run strCmd, 2
========
The statement to echo strCmd is for troubleshooting, to make sure the
command is correct. Note the path and file name are in quotes, and quotes
in a quoted string must be doubled.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Richard Mueller [MVP]
2009-06-10 00:43:53 UTC
Permalink
I think most exe program will run fine without using %comspec% /c. In that
case:

strCmd = """" & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"

This still encloses the path/filename in quotes, in case there are any
spaces in the path.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Tyler Durden
on x32 still worked fine, could not test it on a x64 yet. would be
possible to do it without cmd.exe?
thank you!
Post by Richard Mueller [MVP]
Post by Tyler Durden
The following script runs normally on a x32 environment, and end
without finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
If you are certain the exe is in the specified subfolder of the folder
where the VBScript is saved, perhaps something similar to this would work
===========
Dim WSHShell, strCmd
Set WSHShell = CreateObject("WScript.Shell")
strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
Wscript.Echo strCmd
WSHShell.Run strCmd, 2
========
The statement to echo strCmd is for troubleshooting, to make sure the
command is correct. Note the path and file name are in quotes, and quotes
in a quoted string must be doubled.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Tyler Durden
2009-06-10 22:23:07 UTC
Permalink
I'll try and give feedback here.
Post by Richard Mueller [MVP]
I think most exe program will run fine without using %comspec% /c. In that
strCmd = """" & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
This still encloses the path/filename in quotes, in case there are any
spaces in the path.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Tyler Durden
on x32 still worked fine, could not test it on a x64 yet. would be
possible to do it without cmd.exe?
thank you!
Post by Richard Mueller [MVP]
Post by Tyler Durden
The following script runs normally on a x32 environment, and end
without finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
If you are certain the exe is in the specified subfolder of the folder
where the VBScript is saved, perhaps something similar to this would
===========
Dim WSHShell, strCmd
Set WSHShell = CreateObject("WScript.Shell")
strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
Wscript.Echo strCmd
WSHShell.Run strCmd, 2
========
The statement to echo strCmd is for troubleshooting, to make sure the
command is correct. Note the path and file name are in quotes, and
quotes in a quoted string must be doubled.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Pegasus [MVP]
2009-06-11 22:02:27 UTC
Permalink
i was using a 'portable' latest remote desktop (mstsc.exe) that supports
/admin, on many client computers without lose time installing it. the
problem on x64 was not the vbs (with the command line to the portable
mstsc) but in the fact that no matter what command line you use the system
will always run his own outdated version 5 x64. since I've not updated it,
the command line parameter /admin wasn't accepted. Solved using the old
/console, that still works.
why don't I use a single rdp file? isn't the shortest to type at command
line and in some systems it asks for a confirmation with a security
warning.
thanks to everyone!
Why did you chose to hide the name of the executable from this newsgroup,
calling it "my_exe.exe" instead? If you had been a little less secretive
then this issue would have been resolved much more quickly!
Tyler Durden
2009-06-12 02:01:16 UTC
Permalink
I didn't exactly choose - mstsc is the long story, just wanted to avoid
that.
Post by Pegasus [MVP]
i was using a 'portable' latest remote desktop (mstsc.exe) that supports
/admin, on many client computers without lose time installing it. the
problem on x64 was not the vbs (with the command line to the portable
mstsc) but in the fact that no matter what command line you use the
system will always run his own outdated version 5 x64. since I've not
updated it, the command line parameter /admin wasn't accepted. Solved
using the old /console, that still works.
why don't I use a single rdp file? isn't the shortest to type at command
line and in some systems it asks for a confirmation with a security warning.
thanks to everyone!
Why did you chose to hide the name of the executable from this newsgroup,
calling it "my_exe.exe" instead? If you had been a little less secretive
then this issue would have been resolved much more quickly!
Tyler Durden
2009-06-12 14:48:57 UTC
Permalink
...and I'm going back to /admin, just discovered that the /console parameter
is accepted without errors but does not work... I'll have to update remote
desktop client on x64 systems.
Post by Pegasus [MVP]
i was using a 'portable' latest remote desktop (mstsc.exe) that supports
/admin, on many client computers without lose time installing it. the
problem on x64 was not the vbs (with the command line to the portable
mstsc) but in the fact that no matter what command line you use the
system will always run his own outdated version 5 x64. since I've not
updated it, the command line parameter /admin wasn't accepted. Solved
using the old /console, that still works.
why don't I use a single rdp file? isn't the shortest to type at command
line and in some systems it asks for a confirmation with a security warning.
thanks to everyone!
Why did you chose to hide the name of the executable from this newsgroup,
calling it "my_exe.exe" instead? If you had been a little less secretive
then this issue would have been resolved much more quickly!
Tyler Durden
2009-06-11 21:52:49 UTC
Permalink
the long story:

i was using a 'portable' latest remote desktop (mstsc.exe) that supports
/admin, on many client computers without lose time installing it. the
problem on x64 was not the vbs (with the command line to the portable mstsc)
but in the fact that no matter what command line you use the system will
always run his own outdated version 5 x64. since I've not updated it, the
command line parameter /admin wasn't accepted. Solved using the old
/console, that still works.

why don't I use a single rdp file? isn't the shortest to type at command
line and in some systems it asks for a confirmation with a security warning.

thanks to everyone!
Post by Richard Mueller [MVP]
I think most exe program will run fine without using %comspec% /c. In that
strCmd = """" & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
This still encloses the path/filename in quotes, in case there are any
spaces in the path.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Tyler Durden
on x32 still worked fine, could not test it on a x64 yet. would be
possible to do it without cmd.exe?
thank you!
Post by Richard Mueller [MVP]
Post by Tyler Durden
The following script runs normally on a x32 environment, and end
without finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
If you are certain the exe is in the specified subfolder of the folder
where the VBScript is saved, perhaps something similar to this would
===========
Dim WSHShell, strCmd
Set WSHShell = CreateObject("WScript.Shell")
strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
& "\..\my_program_folder\my_exe.exe"" /param1 /param2"
Wscript.Echo strCmd
WSHShell.Run strCmd, 2
========
The statement to echo strCmd is for troubleshooting, to make sure the
command is correct. Note the path and file name are in quotes, and
quotes in a quoted string must be doubled.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Pegasus [MVP]
2009-06-08 14:54:27 UTC
Permalink
Post by Tyler Durden
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead of
relying on a working directory that may or may not be correct?
Tyler Durden
2009-06-10 00:02:23 UTC
Permalink
full qualified path is not possible as the app is portable, so drive letter
can change.
Post by Tyler Durden
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead of
relying on a working directory that may or may not be correct?
Al Dunbar
2009-06-10 03:44:26 UTC
Permalink
Post by Tyler Durden
full qualified path is not possible as the app is portable, so drive
letter can change.
That only means you cannot pre-specify what the fully qualified path is. But
surely your script can determine what it should be, find the file, and then
run it?

/Al
Post by Tyler Durden
Post by Tyler Durden
The following script runs normally on a x32 environment, and end without
finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
Tyler Durden
2009-06-10 13:30:50 UTC
Permalink
That's what I want :)
Post by Al Dunbar
Post by Tyler Durden
full qualified path is not possible as the app is portable, so drive
letter can change.
That only means you cannot pre-specify what the fully qualified path is.
But surely your script can determine what it should be, find the file, and
then run it?
/Al
Post by Tyler Durden
Post by Tyler Durden
The following script runs normally on a x32 environment, and end
without finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
jford
2009-06-11 13:31:12 UTC
Permalink
Have you echo'd out WSHShell.CurrentDirectory just to make sure it is where
you think it is? Also do you have "On Error Resume Next" in the script?
Post by Tyler Durden
That's what I want :)
Post by Al Dunbar
Post by Tyler Durden
full qualified path is not possible as the app is portable, so drive
letter can change.
That only means you cannot pre-specify what the fully qualified path is.
But surely your script can determine what it should be, find the file, and
then run it?
/Al
Post by Tyler Durden
Post by Tyler Durden
The following script runs normally on a x32 environment, and end
without finding the exe on a x64. What could be the issue?
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
WSHShell.CurrentDirectory = WSHShell.CurrentDirectory &
"\my_program_folder"
WSHShell.Run "my_exe.exe /param1 /param2"
Any help would be appreciated.
Have you tried using a fully qualified path for your .exe file, instead
of relying on a working directory that may or may not be correct?
Loading...