Pausing vbs code until shell script finishes Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Check if a directory exists in a shell scriptHow do I prompt for Yes/No/Cancel input in a Linux shell script?Why doesn't “cd” work in a shell script?How to use SSH to run a shell script on a remote machine?In the shell, what does “ 2>&1 ” mean?How to count all the lines of code in a directory recursively?YYYY-MM-DD format date in shell scriptCheck existence of input argument in a Bash shell scriptHow to call shell script from another shell script?How do I pause my shell script for a second before continuing?

Mistake in years of experience in resume?

Did the Roman Empire have penal colonies?

Passing args from the bash script to the function in the script

Implementing 3DES algorithm in Java: is my code secure?

What is the best way to deal with NPC-NPC combat?

What's the difference between using dependency injection with a container and using a service locator?

My admission is revoked after accepting the admission offer

Prove the alternating sum of a decreasing sequence converging to 0 is Cauchy.

Are these square matrices always diagonalisable?

My bank got bought out, am I now going to have to start filing tax returns in a different state?

Why did C use the -> operator instead of reusing the . operator?

Why does the Cisco show run command not show the full version, while the show version command does?

Is there any hidden 'W' sound after 'comment' in : Comment est-elle?

What's parked in Mil Moscow helicopter plant?

The art of proof summarizing. Are there known rules, or is it a purely common sense matter?

How to translate "red flag" into Spanish?

Is a 5 watt UHF/VHF handheld considered QRP?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

Why isn't everyone flabbergasted about Bran's "gift"?

finding a tangent line to a parabola

How would I use different systems of magic when they are capable of the same effects?

As an international instructor, should I openly talk about my accent?

Multiple options vs single option UI

Second order approximation of the loss function (Deep learning book, 7.33)



Pausing vbs code until shell script finishes



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Check if a directory exists in a shell scriptHow do I prompt for Yes/No/Cancel input in a Linux shell script?Why doesn't “cd” work in a shell script?How to use SSH to run a shell script on a remote machine?In the shell, what does “ 2>&1 ” mean?How to count all the lines of code in a directory recursively?YYYY-MM-DD format date in shell scriptCheck existence of input argument in a Bash shell scriptHow to call shell script from another shell script?How do I pause my shell script for a second before continuing?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to create a script that will auto install a printer.
I found some code that I modified to give the user some prompts. I think the original was a batch file. There are 4 processes that have to shell out to run a cscript command. These are the ones that I need to have paused until they are done. I thought the WaitOnReturn option in the shell command would have made them wait but it doesn't I marked them in the code with 'Need to wait here...

Here is the code.



Dim fso
Dim Folder
Dim ProgramPath
Dim WshShell
Dim ProgramArgs
Dim WaitOnReturn
Dim intWindowStyle

'Dim objShell
'strInput = UserInput( "Enter some input:" )
strInput = MsgBox("This will install the default HP Print driver?",1,"Windows 7 Print Driver Install")
'WScript.Echo "You entered: " & strIpAddress
If strInput = 2 Then
WScript.Echo "Please run again when you are ready"
Else '=1 Prompt for IP Address
'WScript.Echo "You entered: " & strInput
strIpCheck = MsgBox("Do you have the Printers IP Address?",1,"Choose options")
If strIpCheck = 2 Then 'Does not have IP Address
WScript.Echo "Please run again when have the IP Address"
Else 'Start install routine
strIpAddress = InputBox("Enter the IP Address", "IP Address")
Set WshShell = CreateObject("WScript.Shell")
'Create directories
Set FSO = CreateObject("Scripting.FileSystemObject")
If NOT (fso.FolderExists("C:DRIVERS")) Then
fso.CreateFolder("C:DRIVERS")
End If
If NOT (fso.FolderExists("C:SCRIPTS")) Then
fso.CreateFolder("C:SCRIPTS")
End If
'Location of Windows 7 HP print drivers
strSourceDriver = "C:WindowsSystem32DriverStoreFileRepositoryhpoa1so.inf_amd64_neutral_4f1a3f1015001339"
'Location of Win7 built in printer scripts
strSourceScripts = "C:WindowsSystem32Printing_Admin_Scriptsen-US"
If (fso.FolderExists(strSourceDriver)) Then
fso.copyFolder strSourceDriver, "C:DRIVERS"
End If
If (fso.FolderExists(strSourceScripts)) Then
fso.copyFolder strSourceScripts, "C:SCRIPTS"
End If
'Delete existing printer named HP Printer
ProgramPath = "C:SCRIPTSprnmngr.vbs"
ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
intWindowStyle = 1
WaitOnReturn = true
WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
'Need to wait here until the above shell process is done
ProgramPath = "C:SCRIPTSPrnport.vbs"
ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
intWindowStyle = 1
WaitOnReturn = true
WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
'Need to wait here until the above shell process is done
ProgramPath = "C:SCRIPTSPrndrvr.vbs"
ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
intWindowStyle = 1
WaitOnReturn = true
WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
'Need to wait here until the above shell process is done
ProgramPath = "C:SCRIPTSPrnmngr.vbs"
ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
intWindowStyle = 1
WaitOnReturn = true
WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
'Need to wait here until the above shell process is done
End If
End If









share|improve this question




























    0















    I'm trying to create a script that will auto install a printer.
    I found some code that I modified to give the user some prompts. I think the original was a batch file. There are 4 processes that have to shell out to run a cscript command. These are the ones that I need to have paused until they are done. I thought the WaitOnReturn option in the shell command would have made them wait but it doesn't I marked them in the code with 'Need to wait here...

    Here is the code.



    Dim fso
    Dim Folder
    Dim ProgramPath
    Dim WshShell
    Dim ProgramArgs
    Dim WaitOnReturn
    Dim intWindowStyle

    'Dim objShell
    'strInput = UserInput( "Enter some input:" )
    strInput = MsgBox("This will install the default HP Print driver?",1,"Windows 7 Print Driver Install")
    'WScript.Echo "You entered: " & strIpAddress
    If strInput = 2 Then
    WScript.Echo "Please run again when you are ready"
    Else '=1 Prompt for IP Address
    'WScript.Echo "You entered: " & strInput
    strIpCheck = MsgBox("Do you have the Printers IP Address?",1,"Choose options")
    If strIpCheck = 2 Then 'Does not have IP Address
    WScript.Echo "Please run again when have the IP Address"
    Else 'Start install routine
    strIpAddress = InputBox("Enter the IP Address", "IP Address")
    Set WshShell = CreateObject("WScript.Shell")
    'Create directories
    Set FSO = CreateObject("Scripting.FileSystemObject")
    If NOT (fso.FolderExists("C:DRIVERS")) Then
    fso.CreateFolder("C:DRIVERS")
    End If
    If NOT (fso.FolderExists("C:SCRIPTS")) Then
    fso.CreateFolder("C:SCRIPTS")
    End If
    'Location of Windows 7 HP print drivers
    strSourceDriver = "C:WindowsSystem32DriverStoreFileRepositoryhpoa1so.inf_amd64_neutral_4f1a3f1015001339"
    'Location of Win7 built in printer scripts
    strSourceScripts = "C:WindowsSystem32Printing_Admin_Scriptsen-US"
    If (fso.FolderExists(strSourceDriver)) Then
    fso.copyFolder strSourceDriver, "C:DRIVERS"
    End If
    If (fso.FolderExists(strSourceScripts)) Then
    fso.copyFolder strSourceScripts, "C:SCRIPTS"
    End If
    'Delete existing printer named HP Printer
    ProgramPath = "C:SCRIPTSprnmngr.vbs"
    ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
    intWindowStyle = 1
    WaitOnReturn = true
    WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
    'Need to wait here until the above shell process is done
    ProgramPath = "C:SCRIPTSPrnport.vbs"
    ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
    intWindowStyle = 1
    WaitOnReturn = true
    WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
    'Need to wait here until the above shell process is done
    ProgramPath = "C:SCRIPTSPrndrvr.vbs"
    ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
    intWindowStyle = 1
    WaitOnReturn = true
    WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
    'Need to wait here until the above shell process is done
    ProgramPath = "C:SCRIPTSPrnmngr.vbs"
    ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
    intWindowStyle = 1
    WaitOnReturn = true
    WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
    'Need to wait here until the above shell process is done
    End If
    End If









    share|improve this question
























      0












      0








      0








      I'm trying to create a script that will auto install a printer.
      I found some code that I modified to give the user some prompts. I think the original was a batch file. There are 4 processes that have to shell out to run a cscript command. These are the ones that I need to have paused until they are done. I thought the WaitOnReturn option in the shell command would have made them wait but it doesn't I marked them in the code with 'Need to wait here...

      Here is the code.



      Dim fso
      Dim Folder
      Dim ProgramPath
      Dim WshShell
      Dim ProgramArgs
      Dim WaitOnReturn
      Dim intWindowStyle

      'Dim objShell
      'strInput = UserInput( "Enter some input:" )
      strInput = MsgBox("This will install the default HP Print driver?",1,"Windows 7 Print Driver Install")
      'WScript.Echo "You entered: " & strIpAddress
      If strInput = 2 Then
      WScript.Echo "Please run again when you are ready"
      Else '=1 Prompt for IP Address
      'WScript.Echo "You entered: " & strInput
      strIpCheck = MsgBox("Do you have the Printers IP Address?",1,"Choose options")
      If strIpCheck = 2 Then 'Does not have IP Address
      WScript.Echo "Please run again when have the IP Address"
      Else 'Start install routine
      strIpAddress = InputBox("Enter the IP Address", "IP Address")
      Set WshShell = CreateObject("WScript.Shell")
      'Create directories
      Set FSO = CreateObject("Scripting.FileSystemObject")
      If NOT (fso.FolderExists("C:DRIVERS")) Then
      fso.CreateFolder("C:DRIVERS")
      End If
      If NOT (fso.FolderExists("C:SCRIPTS")) Then
      fso.CreateFolder("C:SCRIPTS")
      End If
      'Location of Windows 7 HP print drivers
      strSourceDriver = "C:WindowsSystem32DriverStoreFileRepositoryhpoa1so.inf_amd64_neutral_4f1a3f1015001339"
      'Location of Win7 built in printer scripts
      strSourceScripts = "C:WindowsSystem32Printing_Admin_Scriptsen-US"
      If (fso.FolderExists(strSourceDriver)) Then
      fso.copyFolder strSourceDriver, "C:DRIVERS"
      End If
      If (fso.FolderExists(strSourceScripts)) Then
      fso.copyFolder strSourceScripts, "C:SCRIPTS"
      End If
      'Delete existing printer named HP Printer
      ProgramPath = "C:SCRIPTSprnmngr.vbs"
      ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrnport.vbs"
      ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrndrvr.vbs"
      ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrnmngr.vbs"
      ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      End If
      End If









      share|improve this question














      I'm trying to create a script that will auto install a printer.
      I found some code that I modified to give the user some prompts. I think the original was a batch file. There are 4 processes that have to shell out to run a cscript command. These are the ones that I need to have paused until they are done. I thought the WaitOnReturn option in the shell command would have made them wait but it doesn't I marked them in the code with 'Need to wait here...

      Here is the code.



      Dim fso
      Dim Folder
      Dim ProgramPath
      Dim WshShell
      Dim ProgramArgs
      Dim WaitOnReturn
      Dim intWindowStyle

      'Dim objShell
      'strInput = UserInput( "Enter some input:" )
      strInput = MsgBox("This will install the default HP Print driver?",1,"Windows 7 Print Driver Install")
      'WScript.Echo "You entered: " & strIpAddress
      If strInput = 2 Then
      WScript.Echo "Please run again when you are ready"
      Else '=1 Prompt for IP Address
      'WScript.Echo "You entered: " & strInput
      strIpCheck = MsgBox("Do you have the Printers IP Address?",1,"Choose options")
      If strIpCheck = 2 Then 'Does not have IP Address
      WScript.Echo "Please run again when have the IP Address"
      Else 'Start install routine
      strIpAddress = InputBox("Enter the IP Address", "IP Address")
      Set WshShell = CreateObject("WScript.Shell")
      'Create directories
      Set FSO = CreateObject("Scripting.FileSystemObject")
      If NOT (fso.FolderExists("C:DRIVERS")) Then
      fso.CreateFolder("C:DRIVERS")
      End If
      If NOT (fso.FolderExists("C:SCRIPTS")) Then
      fso.CreateFolder("C:SCRIPTS")
      End If
      'Location of Windows 7 HP print drivers
      strSourceDriver = "C:WindowsSystem32DriverStoreFileRepositoryhpoa1so.inf_amd64_neutral_4f1a3f1015001339"
      'Location of Win7 built in printer scripts
      strSourceScripts = "C:WindowsSystem32Printing_Admin_Scriptsen-US"
      If (fso.FolderExists(strSourceDriver)) Then
      fso.copyFolder strSourceDriver, "C:DRIVERS"
      End If
      If (fso.FolderExists(strSourceScripts)) Then
      fso.copyFolder strSourceScripts, "C:SCRIPTS"
      End If
      'Delete existing printer named HP Printer
      ProgramPath = "C:SCRIPTSprnmngr.vbs"
      ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrnport.vbs"
      ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrndrvr.vbs"
      ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      ProgramPath = "C:SCRIPTSPrnmngr.vbs"
      ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
      intWindowStyle = 1
      WaitOnReturn = true
      WshShell.Run "cscript.exe " & Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs, intWindowStyle, WaitOnReturn
      'Need to wait here until the above shell process is done
      End If
      End If






      shell vbscript pause






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 15:46









      ready4dataready4data

      305




      305






















          1 Answer
          1






          active

          oldest

          votes


















          0














          All WshShell.Run "cscript.exe " & …, intWindowStyle, WaitOnReturn should wait until the called shell process is done providing WaitOnReturn = true. However, output from the following simplified script (where assignments of ProgramArgs are Copied&Pasted from the original code) shows some missing spaces in supplied parameters:



          strIpAddress = "10.10.10.10"

          ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
          Wscript.Echo ProgramArgs


          Output: cscript D:batSO55303301.vbs




          -d -p "HP Printer"
          -a -r 10.10.10.10Port -h 10.10.10.10 -o raw -n 9100
          -a -m "HP Photosmart C8100"-i C:DRIVERShpoa1so.inf -h C:DRIVERS
          -a -p "HP Printer"-m"HP Photosmart C8100"-r 10.10.10.10



          Moreover, the Run method returns an integer. You could grab a process return code to a variable RetCode and then check if its value is zero (when all went OK) using



          RetCode = WshShell.Run ( "cscript.exe " & _
          Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs _
          , intWindowStyle, WaitOnReturn )





          share|improve this answer























          • Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

            – ready4data
            Apr 2 at 13:13











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303301%2fpausing-vbs-code-until-shell-script-finishes%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          All WshShell.Run "cscript.exe " & …, intWindowStyle, WaitOnReturn should wait until the called shell process is done providing WaitOnReturn = true. However, output from the following simplified script (where assignments of ProgramArgs are Copied&Pasted from the original code) shows some missing spaces in supplied parameters:



          strIpAddress = "10.10.10.10"

          ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
          Wscript.Echo ProgramArgs


          Output: cscript D:batSO55303301.vbs




          -d -p "HP Printer"
          -a -r 10.10.10.10Port -h 10.10.10.10 -o raw -n 9100
          -a -m "HP Photosmart C8100"-i C:DRIVERShpoa1so.inf -h C:DRIVERS
          -a -p "HP Printer"-m"HP Photosmart C8100"-r 10.10.10.10



          Moreover, the Run method returns an integer. You could grab a process return code to a variable RetCode and then check if its value is zero (when all went OK) using



          RetCode = WshShell.Run ( "cscript.exe " & _
          Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs _
          , intWindowStyle, WaitOnReturn )





          share|improve this answer























          • Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

            – ready4data
            Apr 2 at 13:13















          0














          All WshShell.Run "cscript.exe " & …, intWindowStyle, WaitOnReturn should wait until the called shell process is done providing WaitOnReturn = true. However, output from the following simplified script (where assignments of ProgramArgs are Copied&Pasted from the original code) shows some missing spaces in supplied parameters:



          strIpAddress = "10.10.10.10"

          ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
          Wscript.Echo ProgramArgs


          Output: cscript D:batSO55303301.vbs




          -d -p "HP Printer"
          -a -r 10.10.10.10Port -h 10.10.10.10 -o raw -n 9100
          -a -m "HP Photosmart C8100"-i C:DRIVERShpoa1so.inf -h C:DRIVERS
          -a -p "HP Printer"-m"HP Photosmart C8100"-r 10.10.10.10



          Moreover, the Run method returns an integer. You could grab a process return code to a variable RetCode and then check if its value is zero (when all went OK) using



          RetCode = WshShell.Run ( "cscript.exe " & _
          Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs _
          , intWindowStyle, WaitOnReturn )





          share|improve this answer























          • Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

            – ready4data
            Apr 2 at 13:13













          0












          0








          0







          All WshShell.Run "cscript.exe " & …, intWindowStyle, WaitOnReturn should wait until the called shell process is done providing WaitOnReturn = true. However, output from the following simplified script (where assignments of ProgramArgs are Copied&Pasted from the original code) shows some missing spaces in supplied parameters:



          strIpAddress = "10.10.10.10"

          ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
          Wscript.Echo ProgramArgs


          Output: cscript D:batSO55303301.vbs




          -d -p "HP Printer"
          -a -r 10.10.10.10Port -h 10.10.10.10 -o raw -n 9100
          -a -m "HP Photosmart C8100"-i C:DRIVERShpoa1so.inf -h C:DRIVERS
          -a -p "HP Printer"-m"HP Photosmart C8100"-r 10.10.10.10



          Moreover, the Run method returns an integer. You could grab a process return code to a variable RetCode and then check if its value is zero (when all went OK) using



          RetCode = WshShell.Run ( "cscript.exe " & _
          Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs _
          , intWindowStyle, WaitOnReturn )





          share|improve this answer













          All WshShell.Run "cscript.exe " & …, intWindowStyle, WaitOnReturn should wait until the called shell process is done providing WaitOnReturn = true. However, output from the following simplified script (where assignments of ProgramArgs are Copied&Pasted from the original code) shows some missing spaces in supplied parameters:



          strIpAddress = "10.10.10.10"

          ProgramArgs = "-d -p " & Chr(34) & "HP Printer" & Chr(34) & ""
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -r " & strIpAddress & "Port -h " & strIpAddress & " -o raw -n 9100"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -m " & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-i C:DRIVERShpoa1so.inf -h C:DRIVERS"
          Wscript.Echo ProgramArgs
          ProgramArgs = "-a -p " & Chr(34) & "HP Printer" & Chr(34) & "-m" & Chr(34) & "HP Photosmart C8100" & Chr(34) & "-r " & strIpAddress
          Wscript.Echo ProgramArgs


          Output: cscript D:batSO55303301.vbs




          -d -p "HP Printer"
          -a -r 10.10.10.10Port -h 10.10.10.10 -o raw -n 9100
          -a -m "HP Photosmart C8100"-i C:DRIVERShpoa1so.inf -h C:DRIVERS
          -a -p "HP Printer"-m"HP Photosmart C8100"-r 10.10.10.10



          Moreover, the Run method returns an integer. You could grab a process return code to a variable RetCode and then check if its value is zero (when all went OK) using



          RetCode = WshShell.Run ( "cscript.exe " & _
          Chr(34) & ProgramPath & Chr(34) & Space(1) & ProgramArgs _
          , intWindowStyle, WaitOnReturn )






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 at 18:13









          JosefZJosefZ

          16.5k42343




          16.5k42343












          • Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

            – ready4data
            Apr 2 at 13:13

















          • Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

            – ready4data
            Apr 2 at 13:13
















          Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

          – ready4data
          Apr 2 at 13:13





          Sorry for the delay I was on vacation. Fixing the spaces and adding the RetCode solved the issue. I thank you.

          – ready4data
          Apr 2 at 13:13



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303301%2fpausing-vbs-code-until-shell-script-finishes%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript