Trouble executing shell command from .vbs for backup

If I run:
c:\windows\system32\ntbackup.exe backup "@C:\File of Disinterest.bks" /n "Monthly Archive created 2008-02-06 at 20`05" /d "Monthly Archive created 2008-02-06 at 20`05" /v:yes /r:no /rs:no /hc:off /m normal /j "Monthly Archival" /l:f /f "X:\Rossamino backup$\Monthly Archive 2008-02-06.bkf" /SNAP:on
from a DOS prompt, it works just fine.  When I run it from .VBS as:
    set wshell = Wscript.crateObject("Wscript.Shell")
    wshell.run "command.com /c " & runstring
where runstring is equal to the command it won't work.  It also won't work if I insert the command in place of runstring and many iterations thereof.

Is there a maximum number of arguments that can be passed with the wshell.run method thingy?
RossaminoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rog DManager Inforamtion SystemsCommented:
You may want to put a breakpoint on the wshell.run statment and get the exact string that is being run, then paste that string on the Run in dos and see what is there?

If it works then I would look further into the wshell.run command in vbs.

Rog
0
Rog DManager Inforamtion SystemsCommented:
Check this link out....

http://weblogs.asp.net/steveschofield/archive/2004/03/14/89240.aspx

They discuss some wshell stuff.  Including some discussion on the double quote and other things too....  This maybe your problem. or it may give you some more ideas of where to look too.

Rog
0
RobSampsonCommented:
No, there is not limit, except for any limit that may be imposed by the program you're running.  The catch, though, is that you need to double your quotes when inserting it into a VBS string, so, without testing it this should work:

'===============
Set objShell = CreateObject("WScript.Shell")
strCommand = "ntbackup.exe backup ""@C:\File of Disinterest.bks"" " & _
      "/n ""Monthly Archive created 2008-02-06 at 20-05"" " & _
      "/d ""Monthly Archive created 2008-02-06 at 20-05"" " & _
      "/v:yes /r:no /rs:no /hc:off /m normal /j ""Monthly Archival"" " & _
      "/l:f /f ""X:\Rossamino backup$\Monthly Archive 2008-02-06.bkf"" /SNAP:on"
strCommand = InputBox("The command to be run is below. You can test it " & _
      "by copying the text into a Start --> Run box.", "Command to Run", strCommand
strResponse = MsgBox("Do you want to run this command?" & VbCrLf & strCommand, _
      vbYesNo, "Run Command?")
If strResponse = vbYes Then
      objShell.Run strCommand, 1, True
      MsgBox "Finished."
Else
      MsgBox "Command cancelled."
End If
'===============

Regards,

Rob.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.