1

How can I run a bat file simultaneously with the vbs script running from same bat file. ie., can I input data into the cmd and the vbs file is also open along with it. I am planning to make an unclosable vbs file but I want the bat file to be running with it too. for example,

<BR>
@ECHO off<BR>
color FC<BR>
cls
<BR>
:start<BR>
ECHO.<BR>
ECHO 1. Hello there is no escape from me.<BR>
ECHO 2. Well come to hell.<BR>
ECHO 3. Bye-Bye.<BR>
C:\Windows\System32\wscript.exe "C:\Users\user\Desktop\bat files\hahaha.vbs"<BR>

set choice=<BR>
set /p choice=Type any number between 1-3 from above choices to escape my wrath.<BR>
if not '%choice%'=='' set choice=%choice:~0,1%<BR>
if '%choice%'=='1' goto hello<BR>
if '%choice%'=='2' goto bye<BR>
if '%choice%'=='3' goto test<BR>
ECHO "%choice%" is not valid please try again<BR>
ECHO.<BR>
goto start<BR>
:hello<BR>
c:\windows\system32\shutdown -s -f -t 10 -c "Deleting all your data!"<BR>
goto end<BR>
:bye<BR>
ECHO woah<BR>
goto end<BR>
:test<BR>
c:\windows\system32\shutdown /h <BR>
goto end<BR>
:end<BR>
PAUSE<BR>
<BR><BR><BR>

so now tell me that can hahaha.vbs(which is a infinte running loop) run along with the bat file where user can input choices into the bat file
so its like "ooh I cant close the vbs file so let me give my choice in the bat file"

0

3 Answers 3

3

Your question is unclear, but I think the START command may be what you're looking for. This allows a process to be started from a batch file, but the batch file will continue executing more commands, instead of waiting for that command to finish.

1

if you want to create the vbs file in the bat you can use this

echo do > test.txt
echo msgbox"hi" >> test.txt
echo loop >> test.txt
ren test.txt test.vbs
start test.vbs
pause 
del test .vbs

this creates an infinite loop of text windows, but you can put whatever in there, it wont have the "wscript.echo" in the .vbs

0

e.g.

test.bat:

start wscript test.vbs

echo "hi there"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.