Wednesday, March 31, 2021

Run Batch File invisibly

 If you want to run batch file invisibly ( no command prompt windows displayed ) , follow the following steps :

1. Copy the following lines to Notepad :

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Batch Files\test.bat" & Chr(34), 0
Set WshShell = Nothing

Note : 
- "C:\Batch Files\test.bat" : Change the path of the bat file. If the VBS file is in the same directory as the bat file, just type the name of the bat file . For example : test.bat

2. Save the notepad as VBS file, for example : invisible_launcher.vbs

3. Double click to run the invisible_launcher.vbs file.

4. If you want to convert the vbs file to exe ( executable file ) , download this program Vbs to Exe Converter

5. Extract the zip file, run Vbs_To_Exe.exe in Portable folder. Click open and choose the vbs file, then click convert button and type the name you want for the exe file.


6. Windows defender will detect the converted exe as a virus. But don't worry, this is just false alarm. Exclude the exe in Windows defender settings.

7. If you run Vbs file in Windows task scheduler, use full path of the batch file location. For example : "C:\Batch Files\test.bat".

No comments:

Post a Comment