How to run VBS code in a batch file?

I know the cscript "filename.VBS" command, but I want to run VBS code within a batch file so I will not have to make a VBS file to do it.

This is my VBS code:

sub Loading do while brw.busy wscript.sleep 350 loop end sub query=inputbox("Please Enter What You Would Like To Search:","Multi-Engine Internet Searcher") 'down-Google set brw=CreateObject("InternetExplorer.Application") brw.navigate "" & (query) brw.toolbar=false brw.statusbar=true brw.height=650 brw.width=950 brw.left=0 brw.top=0 brw.resizable=true Call Loading brw.visible=true 'up-google 'down-bing 
3

1 Answer

Use a hybrid VBS-batch script. Put your VBS part between the <job><script> tags

<!-- : Begin batch script @echo off cscript //nologo "%~f0?.wsf" %1 exit /b ----- Begin wsf script ---> <job><script language="VBScript"> sub Loading do while brw.busy wscript.sleep 350 loop end sub query=inputbox("Please Enter What You Would Like To Search:","Multi-Engine Internet Searcher") 'down-Google set brw=CreateObject("InternetExplorer.Application") brw.navigate "" & (query) brw.toolbar=false brw.statusbar=true brw.height=650 brw.width=950 brw.left=0 brw.top=0 brw.resizable=true Call Loading brw.visible=true 'up-google 'down-bing </script></job> 

See Is it possible to embed and execute VBScript within a batch file without using a temporary file?

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like