Just wondering if anyone can help me with a problem?
I'm running a vbs script via a shortcut with a switch on the end of the shortcut. I need to return the value of the switch within the script its self. e.g. if the target of the shortcut was:
I need to return "HebronClientLauncher" within the vbs file if its possible. I can return the script name using the WScript.ScriptName command but can't work out how to return the switch
What James said.
Too slow Matt, too slow.
Admittedly only by seconds.
Yer, starting to feel my age... even tho I'm younger then you!!
I'll go with excuse no3. - I'm rather busy at the moment...
I used the script and it doesn't error so I suppose it thinks it's working correctly. The only problem is it still doesn't return the Argument. I just get 0 returned as the Argument is empty I'll have to play a bit more.
If you do
gives you "-HebronClientLauncher" - not the "-" so if you're just checking for the text it won't work (and your script will error if there's no argument at all)
If you do:
and then in code do:
then sName will be set to HebronClientLauncher (or whatever) and no error if there's no argument.
I'll try that later... just struggling with office 2007 deployment at the moment which has taken presidents over this
If you wanted to specify a switch followed by switch value then you can use named arguments e.g.:
So you can call your script as follows:Code:Set objArgs = WScript.Arguments Set objArgNamed = objArgs.named strSwitch = objNamed("Switch")
Dont need to do it this way but is an option.Code:foo.vbs /Switch:bar
Thanks apeo I got it working using your script in the end
thanks to everyone else for the help as well
There are currently 1 users browsing this thread. (0 members and 1 guests)