Run command in VBScript
Friday, December 9, 2011 by wc2005 | Discussion: OS Customization
I want to pass the working directory into the Run command in VBScript like this:
- Set s = CreateObject ("WScript.Shell")
- s.Run Chr(34)&"k:\SAMURAI WARRIORS 2\SW2.exe"&Chr(34)&" "&Chr(34)&"k:\SAMURAI WARRIORS 2"&Chr(34)
but it doesn't work. Would someone help me, please? Thanks!
Reply #2 Friday, December 9, 2011 7:19 AM
Well Chr(34) = ", so in effect you're asking your script to execute ""k:\SAMURAI WARRIOS 2\SW2.exe" & " & "k:\SAMURAI WARRIORS 2" & "
I believe command line doesn't require quotations to execute a program.
Reply #3 Saturday, December 10, 2011 2:27 AM
Thanks for your replies!
If it's too difficult or impossible to pass the working directory into run command, your solution is the only one for me to go.
I believe command line doesn't require quotations to execute a program.
Without quotations, you can run a program whose path doesn't contain spaces in it. If your path contains spaces, you have to use quotations or you'll get invalid path errors because Windows considers space as a delimiter between the program and its parameters.
In general, I just want to know how to pass the working directory as a parameter into Run command in VBScript because some games require this parameter (working directory) to run, I have searched around without answer. It seems this is impossible. So, BigDogBigFeet has the answer for me.
Thanks a lot, again, guys!
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Friday, December 9, 2011 6:55 AM
Why don't you just create a shortcut that runs samurai warrior s 2 the way you want it and then just run that shortcut with your script?