GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

Problems calling a vb sript from a vbscript

Home Forums Scripting General Scripting Problems calling a vb sript from a vbscript

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    RSeeds
    Member
    #130065

    I am new to VB scripting so please be patient with me.

    I am trying to “call” or “execute” a VB script file from within a VB Script.

    The problem is that if the .vbs file has a space in the name, or a space in the path to the file name, then WSHShell.run always fails. If there are no spaces in the file name or to the path to the .vbs file, the code works perfectly. Even when I used the fully quotated UNC path name, WSHShell.run still fails.

    Here is the code I am using that does NOT work:

    Set WSHShell = CreateObject(“WScript.Shell”)
    WSHShell.Run “Map Printers.vbs”
    ‘ or
    WSHShell.Run “ScriptsMap Printers.vbs”

    Here is the code I am using that DOES work:

    Set WSHShell = CreateObject(“WScript.Shell”)
    WSHShell.Run “MapPrinters.vbs”
    ‘ or
    WSHShell.Run “scriptsMapPrinters.vbs”

    What is the correct syntax required to use to run a VB script from a VB script which has spaces in the filename or spaces within the path to the file name?

    Thanks in advance,

    Bob Seeds

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.