[vbscript] Running vbscript from batch file

I just need to write a simple batch file just to run a vbscript. Both the vbscript and the batch file are in the same folder and is in the SysWOW64 directory as the vbscript can only be execute in that directory. Currently my batch file is as follows:

@echo off
%WINDIR%\SysWOW64\cmd.exe
cscript necdaily.vbs

But the vbscript wasn't executed and just the command prompt is open. Can anyone tell me how can i execute the vbscript when i run this batch file?

This question is related to vbscript batch-file 32bit-64bit 32-bit syswow64

The answer is


Just try this code:

start "" "C:\Users\DiPesh\Desktop\vbscript\welcome.vbs"

and save as .bat, it works for me


Well i am trying to open a .vbs within a batch file without having to click open but the answer to this question is ...

SET APPDATA=%CD%

start (your file here without the brackets with a .vbs if it is a vbd file)


This is the command for the batch file and it can run the vbscript.

C:\Windows\SysWOW64\cmd.exe /c cscript C:\Windows\SysWOW64\...\necdaily.vbs

Batch files are processed row by row and terminate whenever you call an executable directly.
- To make the batch file wait for the process to terminate and continue, put call in front of it.
- To make the batch file continue without waiting, put start "" in front of it.

I recommend using this single line script to accomplish your goal:

@call cscript "%~dp0necdaily.vbs"

(because this is a single line, you can use @ instead of @echo off)

If you believe your script can only be called from the SysWOW64 versions of cmd.exe, you might try:

@%WINDIR%\SysWOW64\cmd.exe /c call cscript "%~dp0necdaily.vbs"

If you need the window to remain, you can replace /c with /k


You can use %~dp0 to get the path of the currently running batch file.

Edited to change directory to the VBS location before running

If you want the VBS to synchronously run in the same window, then

@echo off
pushd %~dp0
cscript necdaily.vbs

If you want the VBS to synchronously run in a new window, then

@echo off
pushd %~dp0
start /wait "" cmd /c cscript necdaily.vbs

If you want the VBS to asynchronously run in the same window, then

@echo off
pushd %~dp0
start /b "" cscript necdaily.vbs

If you want the VBS to asynchronously run in a new window, then

@echo off
pushd %~dp0
start "" cmd /c cscript necdaily.vbs

Examples related to vbscript

How to run VBScript from command line without Cscript/Wscript How to set recurring schedule for xlsm file using Windows Task Scheduler How to prevent 'query timeout expired'? (SQLNCLI11 error '80040e31') How do I rename a file using VBScript? How to get two or more commands together into a batch file How to run vbs as administrator from vbs? Find specific string in a text file with VBS script Getting current directory in VBScript Run Command Line & Command From VBS Permission denied on CopyFile in VBS

Examples related to batch-file

'ls' is not recognized as an internal or external command, operable program or batch file '' is not recognized as an internal or external command, operable program or batch file XCOPY: Overwrite all without prompt in BATCH CanĀ“t run .bat file under windows 10 Execute a batch file on a remote PC using a batch file on local PC Windows batch - concatenate multiple text files into one How do I create a shortcut via command-line in Windows? Getting Error:JRE_HOME variable is not defined correctly when trying to run startup.bat of Apache-Tomcat Curl not recognized as an internal or external command, operable program or batch file Best way to script remote SSH commands in Batch (Windows)

Examples related to 32bit-64bit

MS Access DB Engine (32-bit) with Office 64-bit Running vbscript from batch file Can't start Eclipse - Java was started but returned exit code=13 how much memory can be accessed by a 32 bit machine? CentOS 64 bit bad ELF interpreter Range of values in C Int and Long 32 - 64 bits Is it possible to install both 32bit and 64bit Java on Windows 7? How to find out if an installed Eclipse is 32 or 64 bit version? Missing include "bits/c++config.h" when cross compiling 64 bit program on 32 bit in Ubuntu Should I use Python 32bit or Python 64bit

Examples related to 32-bit

Class not registered Error Running vbscript from batch file How do I detect whether 32-bit Java is installed on x64 Windows, only looking at the filesystem and registry? Skipping Incompatible Libraries at compile How do I run a VBScript in 32-bit mode on a 64-bit machine? Are 64 bit programs bigger and faster than 32 bit versions? How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)? "An attempt was made to load a program with an incorrect format" even when the platforms are the same How to compile a 32-bit binary on a 64-bit linux machine with gcc/cmake Java 32-bit vs 64-bit compatibility

Examples related to syswow64

Running vbscript from batch file Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit Windows?