Newbie - Call batch file from a logon script

Discussion in 'Scripting' started by TNG, Sep 11, 2005.

  1. TNG

    TNG Guest

    Hi,

    Can anybody tell me how to call a batch file from a wscript logon script ?

    Thx in advance

    TNG
     
    TNG, Sep 11, 2005
    #1
    1. Advertisements

  2. Assuming you're using VBScript, you start out by creating an instance of
    WScript.Shell -

    Dim WshShell: Set WshShell = CreateObject("WScript.Shell")

    Then you can use its Run method. Try to use an absolute path name without
    spaces for the path to the batch file. If it's in the same directory as the
    WSH script (likely in your netlogon share) then you may need to specify the
    path relative to the script itself; assuming that you haven't changed
    directories, the batch file could be found like this:

    WshShell.Run "%0\..\mybatch.cmd"

    To run it hidden (0) and wait for the batch file to terminate before
    continuing (true) do this:
    WshShell.Run "%0\..\mybatch.cmd", 0, true
     
    Alex K. Angelopoulos \(MVP\), Sep 11, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.