Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Run an existing .bat & .vbs script from a .bat or .vbs  (Read 3333 times)

0 Members and 1 Guest are viewing this topic.

petreli

    Topic Starter


    Rookie

    Run an existing .bat & .vbs script from a .bat or .vbs
    « on: June 09, 2009, 09:40:06 AM »
    Hi

    I would like to be able to call/run a existing .bat & .vbs file from a new .bat or .vbs. hoping this would include a pop up message to confirm the action has been completed.

    I can add message to .vbs script ok MsgBox ("complete"), vbInformation, "Updated"

    At the moment I have to run 2 scripts (.bat & .vbs) but I want to be able to call both and run both of these.

    Thanks in advance for any help

    billrich

    • Guest
    Re: Run an existing .bat & .vbs script from a .bat or .vbs
    « Reply #1 on: June 09, 2009, 10:13:29 AM »
    C:\>type  runany.bat
    Code: [Select]
    C:\WINDOWS\system32\cscript.exe C:\WINDOWS\system32\eventquery.vbs

    C:\>type  runany.bat
    Code: [Select]
    C:\WINDOWS\system32\cscript.exe C:\WINDOWS\system32\eventquery.vbs

    c:\whatis.bat


    C:\>type  whatis.bat

    Code: [Select]
    @echo %%~f0 is %~f0
    @pause
    C:\>

    Output from runany.bat :

     information   4201   5/9/2009 8:42:16 PM      Tcpip             NEWBILL
     warning       27     5/9/2009 7:23:09 PM      e1express         NEWBILL
     information   7036   5/9/2009 6:48:10 PM      Service Control M NEWBILL
     information   7036   5/9/2009 6:43:44 PM      Service Control M NEWBILL
      information   4377   5/8/2009 6:09:48 PM      NtServicePack     NEWBILL


    C:\>c:\whatis.bat
    %~f0 is c:\whatis.bat
    Press any key to continue . . .

    C:\>
    « Last Edit: June 09, 2009, 10:26:35 AM by billrich »

    petreli

      Topic Starter


      Rookie

      Re: Run an existing .bat & .vbs script from a .bat or .vbs
      « Reply #2 on: June 11, 2009, 07:24:51 AM »
      Hi I have created, something like this, create a temp folder, then I want the 2009v2.vbs file to run

      @echo off
      md c:\temp


      cd "C:\\Other\2009v2.vbs"

      The vbs file won't run

      petreli

        Topic Starter


        Rookie

        Re: Run an existing .bat & .vbs script from a .bat or .vbs
        « Reply #3 on: June 11, 2009, 10:00:55 AM »
        figured out this

        cscript "C:\Other\2009v2.vbs"

        However it does run, but I receive an error message on the bat...

        how do I prevent the bat file from showing, or make smaller