How to Execute Programs With VBS

104 2
    • 1). Right-click the VBS file you want to edit and select "Open With." Select "Notepad" from the list of programs. You can also start a new script by opening Notepad.

    • 2). Open a shell object. The shell object runs the executable files located on the machine. The code below creates the object:
      Set my_shell = CreateObject("WScript.Shell")

    • 3). Run the program from the VBS file. The shell object opened previously has a "run" method that executes software. The code below runs the software:
      my_shell.Run "c:\windows\my_program"
      Replace "my_program" with the executable you want to run.

    • 4). Close the shell objects. You need to close the shell object and remove it from memory. The code below deletes the shell object:
      Set my_shell = Nothing

    • 5). Save the file to your hard drive. Make sure you save it with a .vbs extension. Double-click it to test the programming. The file runs and executes the software indicated in the script.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.