Convert Bat File to VB Script?

Posted on 2011-05-10
Last Modified: 2012-06-27
Can someone please help me convert this line of bat file into VB Script format? Thank you.

@echo off
 schtasks.exe /change /tn "\Microsoft\ScheduedTask1" /enable
 schtasks.exe /run /tn "\Microsoft\ScheduedTask1"
 schtasks.exe /end /s /tn "\Microsoft\ScheduedTask1"
 schtasks.exe /change /s /tn "\Microsoft\ScheduedTask1" /disable
Question by:mmoya
    LVL 4

    Expert Comment

    LVL 67

    Accepted Solution

    Basically this should do it...
    Dim objShell : Set objShell = CreateObject("Wscript.Shell")
    With objShell
      .Run "schtasks.exe /change /tn " & chr(34) & "\Microsoft\ScheduedTask1" & chr(34) & " /enable"
      .Run "schtasks.exe /run /tn " & chr(34) & "\Microsoft\ScheduedTask1" & chr(34)
      .Run "schtasks.exe /end /s /tn " & chr(34) & "\Microsoft\ScheduedTask1" & chr(34)
      .Run "schtasks.exe /change /s /tn " & chr(34) & "\Microsoft\ScheduedTask1" & chr(34) & " /disable"
    End With

    Open in new window

    LVL 67

    Expert Comment

    Happy to help - thanx for the grade! :^)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This is an addendum to the following article: Acitve Directory based Outlook Signature ( The script is fine, and works in normal client-server domains…
    In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now