PDF download Download Article PDF download Download Article

This wikiHow teaches you how to run a Visual Basic script on a Windows PC. Visual Basic is a Windows-specific programming language, so you'll only be able to run your script using Windows.

Method 1
Method 1 of 3:

Using the Windows Command Prompt

PDF download Download Article
  1. An easy way to do this is to press Windows key + S to open the search bar, type command into the bar, and then click Command prompt in the search results.
    • You may also be able to open the command prompt by pressing Windows key + X and selecting Command prompt. If you don't see this option there, you can select PowerShell –the command we'll be using will work in both the standard command prompt and PowerShell.[1]
  2. You can use the cd command to do this.
    • For example, if the script is saved to C:\Windows\Scripts, type cd C:\Windows\Scripts and press Enter.
    • The name of your script usually ends with the .VBS file extension.
    Advertisement
  3. Replace scriptname.vbs with the name of the script you want to run. This displays the output of the script in the window.[2]
  4. Advertisement
Method 2
Method 2 of 3:

Using the Run Dialog

PDF download Download Article
  1. Pressing Windows key + R' opens the Run dialog, which allows you to select and run any script or program.
  2. This opens the file browser.
  3. If you don't see your script, click the drop-down menu at the bottom-right corner and select All files instead.
    • The script will usually end with the *.VBS file extension.
  4. This runs the script.
  5. Advertisement
Method 3
Method 3 of 3:

Using Windows Explorer

PDF download Download Article
  1. This displays a list of files on your PC.
  2. The script likely ends with the .VBS file extension.[3]
  3. This runs the Visual Basic script.
    • If the script is a console script, it will open a command prompt window and display the output.[4]
  4. Advertisement

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!

You Might Also Like

Run a Batch File from the Command Line on Windows Run a Windows Batch File from the Command Line (CMD)
Use Windows Command Prompt to Run a Python File Use Command Prompt to Run a Python File on Windows
Open Terminal in Windows Open the Windows Terminal: A Quick Guide
Run a Program on Command Prompt Run a Program at the Windows Command Prompt: 2 Ways
Run a BAT File on Windows3 Ways to Run a Batch (.BAT) file on Windows and More
Run an EXE File From Command PromptRun an EXE File From the Command Prompt on Windows 10 & 11
Open a Folder in Cmd Open a Folder in Command Prompt (CMD)
Run C Program in Command Prompt Run a C Program Using Developer Command Prompt
Powershell How to Run ExeRunning EXE Files in PowerShell: Simple Commands
Open the Command Prompt in Windows6 Simple Ways to Open the Command Line in Windows
Run Ruby CodeRun Ruby Code
Use MS DOS Use MS DOS
Copy Files in Command PromptCopy Files in Command Prompt
Make Your Computer Welcome YouMake Your Computer Welcome You
Advertisement

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 103,807 times.
How helpful is this?
Co-authors: 4
Updated: August 10, 2022
Views: 103,807
Categories: Basic Computer Skills
Article SummaryX

1. To run a script from the command prompt, use "cscript scriptname.
2. To run a script from Windows Explorer, double-click the script.
3. To run the script from the Run dialog, open the Run dialog, browse for the script, and click OK.

Did this summary help you?

Thanks to all authors for creating a page that has been read 103,807 times.

Is this article up to date?

Advertisement