Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > issue on scripting syntax on x64

Reply
Thread Tools Display Modes

issue on scripting syntax on x64

 
 
Tyler Durden
Guest
Posts: n/a

 
      06-08-2009
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.


 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      06-08-2009

"Tyler Durden" <> wrote in message
news:...
> 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?


 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      06-08-2009

"Pegasus [MVP]" <> wrote in message
news:...
>
> "Tyler Durden" <> wrote in message
> news:...
>> 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
--


 
Reply With Quote
 
Tyler Durden
Guest
Posts: n/a

 
      06-10-2009
full qualified path is not possible as the app is portable, so drive letter
can change.

"Pegasus [MVP]" <> wrote in message
news:...
>
> "Tyler Durden" <> wrote in message
> news:...
>> 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?
>



 
Reply With Quote
 
Tyler Durden
Guest
Posts: n/a

 
      06-10-2009
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-> wrote in
message news:%...
>
> "Pegasus [MVP]" <> wrote in message
> news:...
>>
>> "Tyler Durden" <> wrote in message
>> news:...
>>> 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
> --
>
>



 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      06-10-2009
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" <> wrote in message
news:eGU6K%...
> 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-> wrote in
> message news:%...
>>
>> "Pegasus [MVP]" <> wrote in message
>> news:...
>>>
>>> "Tyler Durden" <> wrote in message
>>> news:...
>>>> 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
>> --
>>
>>

>
>



 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a

 
      06-10-2009

"Tyler Durden" <> wrote in message
news:...
> 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]" <> wrote in message
> news:...
>>
>> "Tyler Durden" <> wrote in message
>> news:...
>>> 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?
>>

>
>




 
Reply With Quote
 
Tyler Durden
Guest
Posts: n/a

 
      06-10-2009
That's what I want


"Al Dunbar" <> wrote in message
news:%23s$...
>
> "Tyler Durden" <> wrote in message
> news:...
>> 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]" <> wrote in message
>> news:...
>>>
>>> "Tyler Durden" <> wrote in message
>>> news:...
>>>> 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?
>>>

>>
>>

>
>
>



 
Reply With Quote
 
Tyler Durden
Guest
Posts: n/a

 
      06-10-2009
I'll try and give feedback here.

"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:%...
>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" <> wrote in message
> news:eGU6K%...
>> 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-> wrote in
>> message news:%...
>>>
>>> "Pegasus [MVP]" <> wrote in message
>>> news:...
>>>>
>>>> "Tyler Durden" <> wrote in message
>>>> news:...
>>>>> 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
>>> --
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
jford
Guest
Posts: n/a

 
      06-11-2009
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?

"Tyler Durden" wrote:

> That's what I want
>
>
> "Al Dunbar" <> wrote in message
> news:%23s$...
> >
> > "Tyler Durden" <> wrote in message
> > news:...
> >> 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]" <> wrote in message
> >> news:...
> >>>
> >>> "Tyler Durden" <> wrote in message
> >>> news:...
> >>>> 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?
> >>>
> >>
> >>

> >
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Last known logon - Scripting/LDAP issue Rob Commarota Windows Server 0 07-07-2006 01:01 PM
Re: Last known logon - Scripting/LDAP issue Pegasus \(MVP\) Windows Server 0 07-04-2006 10:30 PM
sql syntax issue UNIORYOU Windows Media Center 0 04-20-2006 05:37 AM
preferred ADSI scripting syntax ?? J Ford Scripting 1 04-20-2005 12:50 AM
WSH Scripting Syntax Jeff Giroux Scripting 5 04-04-2004 11:30 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59