+ Post New Thread
Results 1 to 2 of 2
Coding Thread, Run one VBS script from another in Coding and Web Development; So the topic says it all, in order to minimise printer script maintenance I want to run one VB script ...
  1. #1

    Join Date
    Nov 2007
    Location
    Rotherham
    Posts
    1,675
    Thank Post
    122
    Thanked 126 Times in 102 Posts
    Rep Power
    45

    Run one VBS script from another

    So the topic says it all, in order to minimise printer script maintenance I want to run one VB script from within another one.

    So essentially I'm using this
    Code:
    Set WshShell = WScript.CreateObject( "WScript.Shell" )		
    Wshshell.run ("""c:\users\me\desktop\staff Printers.vbs""")
    Which all works nicely.

    However when I modify it to run on the netwotk to:
    Code:
    Set WshShell = WScript.CreateObject( "WScript.Shell" )		
    Wshshell.run ("""\\<domain Name>\Sysvol\<domain>\scripts\printer\staff Printers.vbs""")
    it fails. As far as I can tell it's not running the script. Yet if I run \\<domain Name>\Sysvol\<domain>\scripts\printer\staff Printers.vbs manually on the PC it runs and does it's thing so I know it's not that the PC cant's see the file.

    And now I'm confused and I don't know whats up?

  2. #2
    pleach85's Avatar
    Join Date
    Jan 2011
    Posts
    22
    Thank Post
    3
    Thanked 6 Times in 6 Posts
    Rep Power
    9
    I tend to set a variable DQ to chr(34) (Double Quotes) and then use that in the run command. Using """ caused me problems too!

    Code:
    Set WshShell = WScript.CreateObject( "WScript.Shell" )	
    DQ = chr(34)
    Wshshell.run (DQ & "\\<domain Name>\Sysvol\<domain>\scripts\printer\staff Printers.vbs" & DQ)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 8
    Last Post: 19th April 2012, 04:29 PM
  2. Replies: 4
    Last Post: 11th January 2011, 09:39 PM
  3. "Run as" VB Script
    By storkyIV in forum Scripts
    Replies: 16
    Last Post: 27th January 2010, 09:53 PM
  4. Can you run two PC's from one network outlet
    By gloriousglenn in forum Network and Classroom Management
    Replies: 23
    Last Post: 19th January 2008, 01:12 PM
  5. Replies: 13
    Last Post: 8th November 2007, 02:53 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •