HEELPBOOK - HOW TO EMBED VBSCRIPT IN CMD/BAT SCRIPT (VBSCRIPT VS. BATCH DOS) ############################## A leading colon in a batch file is ignored because it denotes a label; it is ignored in VBscript because it is a command separator. Thus the batch script can search itself for lines beginning with a colon and write them out to a temporary vbs file and then execute it. ############### EXAMPLE @echo off echo This is batch :wscript.echo "This VBScript" :wscript.echo "Today is " & day(date) & "-" & month(date) & "-" & year(date) findstr "^:" "%~sf0">temp.vbs & cscript //nologo temp.vbs & del temp.vbs echo This is batch again ############### THE RESULT This is batch This VBScript Today is 21-4-2010 This is batch again Maybe you want to use some GUI feature of wscript e.g. to get user input... ############### ANOTHER EXAMPLE @echo off :wscript.echo InputBox("Enter your name") findstr "^:" "%~sf0">temp.vbs & for /f "delims=" %%N in ('cscript //nologo temp.vbs') do set name=%%N & del temp.vbs echo You entered %name% ############ ARTICLE INFO ############# Article Month: March Article Date: 01/03/2013 Permalink: http://heelpbook.altervista.org/2013/how-to-embed-vbscript-in-cmdbat-script-vbscript-vs-batch-dos/ Source: http://www.computerhope.com/forum/index.php?topic=103686.0 Language: English View more articles on: http://www.heelpbook.net/ Follow us on Facebook: http://it-it.facebook.com/pages/HeelpBook/100790870008832 Follow us on Twitter: https://twitter.com/#!/HeelpBook Follow us on RSS Feed: http://feeds.feedburner.com/Heelpbook Follow us on Delicious: http://delicious.com/heelpbook Linkedin: http://it.linkedin.com/pub/stefano-maggi/27/73a/b20 Google+ : https://plus.google.com/116990277568167008289/posts