Home All Groups Group Topic Archive Search About

issue on scripting syntax on x64

Author
8 Jun 2009 2:45 PM
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.

Author
8 Jun 2009 2:54 PM
Pegasus [MVP]
"Tyler Durden" <abuse@antispam.org> wrote in message
news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
> 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?
Author
8 Jun 2009 3:15 PM
Richard Mueller [MVP]
Show quote Hide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>> 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
--
Author
10 Jun 2009 12:08 AM
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!

Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:%23ECf7vE6JHA.1092@TK2MSFTNGP06.phx.gbl...
>
> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>
>> "Tyler Durden" <abuse@antispam.org> wrote in message
>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>> 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
> --
>
>
Author
10 Jun 2009 12:43 AM
Richard Mueller [MVP]
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
--

Show quoteHide quote
"Tyler Durden" <abuse@antispam.org> wrote in message
news:eGU6K%23V6JHA.2656@TK2MSFTNGP05.phx.gbl...
> on x32 still worked fine, could not test it on a x64 yet. would be
> possible to do it without cmd.exe?
>
> thank you!
>
> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
> message news:%23ECf7vE6JHA.1092@TK2MSFTNGP06.phx.gbl...
>>
>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Tyler Durden" <abuse@antispam.org> wrote in message
>>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>> 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
>> --
>>
>>
>
>
Author
10 Jun 2009 10:23 PM
Tyler Durden
I'll try and give feedback here.

Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:%23dIHRSW6JHA.3592@TK2MSFTNGP02.phx.gbl...
>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
> --
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:eGU6K%23V6JHA.2656@TK2MSFTNGP05.phx.gbl...
>> on x32 still worked fine, could not test it on a x64 yet. would be
>> possible to do it without cmd.exe?
>>
>> thank you!
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>> message news:%23ECf7vE6JHA.1092@TK2MSFTNGP06.phx.gbl...
>>>
>>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>>> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>>
>>>> "Tyler Durden" <abuse@antispam.org> wrote in message
>>>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>>> 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
>>> --
>>>
>>>
>>
>>
>
>
Author
11 Jun 2009 9:52 PM
Tyler Durden
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!


Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:%23dIHRSW6JHA.3592@TK2MSFTNGP02.phx.gbl...
>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
> --
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:eGU6K%23V6JHA.2656@TK2MSFTNGP05.phx.gbl...
>> on x32 still worked fine, could not test it on a x64 yet. would be
>> possible to do it without cmd.exe?
>>
>> thank you!
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>> message news:%23ECf7vE6JHA.1092@TK2MSFTNGP06.phx.gbl...
>>>
>>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>>> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>>
>>>> "Tyler Durden" <abuse@antispam.org> wrote in message
>>>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>>> 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
>>> --
>>>
>>>
>>
>>
>
>
Author
11 Jun 2009 10:02 PM
Pegasus [MVP]
Show quote Hide quote
"Tyler Durden" <abuse@antispam.org> wrote in message
news:%23GVX37t6JHA.1420@TK2MSFTNGP04.phx.gbl...
> 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!

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!
Author
12 Jun 2009 2:01 AM
Tyler Durden
I didn't exactly choose - mstsc is the long story, just wanted to avoid
that.


Show quoteHide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:%23ZRdPBu6JHA.1196@TK2MSFTNGP03.phx.gbl...
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:%23GVX37t6JHA.1420@TK2MSFTNGP04.phx.gbl...
>> 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!
>
> 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!
>
Author
12 Jun 2009 2:48 PM
Tyler Durden
....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.


Show quoteHide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:%23ZRdPBu6JHA.1196@TK2MSFTNGP03.phx.gbl...
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:%23GVX37t6JHA.1420@TK2MSFTNGP04.phx.gbl...
>> 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!
>
> 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!
>
Author
10 Jun 2009 12:02 AM
Tyler Durden
full qualified path is not possible as the app is portable, so drive letter
can change.

Show quoteHide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>> 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?
>
Author
10 Jun 2009 3:44 AM
Al Dunbar
"Tyler Durden" <abuse@antispam.org> wrote in message
news:Ou6gV9V6JHA.5180@TK2MSFTNGP04.phx.gbl...
> 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

Show quoteHide quote
> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>
>> "Tyler Durden" <abuse@antispam.org> wrote in message
>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>> 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?
>>
>
>
Author
10 Jun 2009 1:30 PM
Tyler Durden
That's what I want :)


Show quoteHide quote
"Al Dunbar" <aland***@hotmail.com> wrote in message
news:%23s$AB3X6JHA.2656@TK2MSFTNGP05.phx.gbl...
>
> "Tyler Durden" <abuse@antispam.org> wrote in message
> news:Ou6gV9V6JHA.5180@TK2MSFTNGP04.phx.gbl...
>> 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
>
>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Tyler Durden" <abuse@antispam.org> wrote in message
>>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
>>>> 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?
>>>
>>
>>
>
>
>
Author
11 Jun 2009 1:31 PM
jford
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?

Show quoteHide quote
"Tyler Durden" wrote:

> That's what I want :)
>
>
> "Al Dunbar" <aland***@hotmail.com> wrote in message
> news:%23s$AB3X6JHA.2656@TK2MSFTNGP05.phx.gbl...
> >
> > "Tyler Durden" <abuse@antispam.org> wrote in message
> > news:Ou6gV9V6JHA.5180@TK2MSFTNGP04.phx.gbl...
> >> 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
> >
> >> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> >> news:ul8XGkE6JHA.1432@TK2MSFTNGP02.phx.gbl...
> >>>
> >>> "Tyler Durden" <abuse@antispam.org> wrote in message
> >>> news:Oq7zzeE6JHA.1432@TK2MSFTNGP02.phx.gbl...
> >>>> 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?
> >>>
> >>
> >>
> >
> >
> >
>
>
>