No announcement yet. help

  • Filter
  • Time
  • Show
Clear All
new posts

  • help

    I can't seem to get the right way to put two commands in one line of, I think my quotations are right, but the errors are pointing to where I try to continue the code onto the next line:

    Set objShell = CreateObject("Wscript.Shell")
    strSession = InputBox("Enter the session to restore:")
    strRestorePath = BrowseForFolder("Choose the Restore Path:", &H4031, &H0011)
    strTarget = InputBox("Enter the target computer name to redirect to:")
    objShell.Run("""%comspec% /K cd C:\Program Files\OmniBack\bin |omnir & _
    		-winfs ""H:""  & _
    		-session ""strSession"" -tree ""strRestorePath""  -target ""strTarget""  & _
    		-as /tmp"""), 0, True
    Set objShell = Nothing

  • #2
    Re: help

    Its a bit tricky when using, the whole command must between quotes. But when you add a break in the line you must first close the actual quote then add '& _' . Starting the new line with a quote. Another thing is when you have to use quotations within quotations. For the quotations you use in the actual command-line replace these with & chr(34) &.

    A good practice is to set parameters in advance;
    someting like this:
    Set objShell = CreateObject("Wscript.Shell")
    sBoxTitle = "Results OMNIR"
    'cumulative command-line building
    strCommand = "%comspec% /T:84 /K title " & sBoxTitle & "|"
    strCommand = strCommand & chr(34) & "C:\Program Files\OmniBack\bin\omnir.exe" & chr(34)
    strCommand = strCommand & " -winfs " &chr(34) _
                                                       & "H:" & chr(34)
    strCommand = strCommand & " -session " &chr(34) & "strSession" &chr(34)
    strCommand = strCommand & " -tree " &chr(34) & "strRestorePath" &chr(34)
    strCommand = strCommand & " -target " &chr(34)& "strTarget" & chr(34)
    strCommand = strCommand & " -as /tmp"
    wscript.echo strCommand  ' <---temporarily (to test if the command line is correct)
    Set objShell = Nothing
    now the dos-box is left open after the command

    Last edited by Rems; 6th March 2007, 13:41. Reason: program path must also be between quotes, done

    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts


    • #3
      Re: help

      Ahhh I see, thank you this will be very useful.