-1

I want to make this .bat file to read the answer given on the newly made .vbs file (yes or a no question).

I don't know any solutions right now

echo x=msgbox("By performing this action you will lose access to the Vault, however you can regain access using the Vault Key. Are you sure you want to lock the Vault?" ,vbYesNo, "Lock Confirmation") >> msgbox.vbs

start msgbox.vbs

if msgbox=vbYes goto LOCK

else goto End

This results in the program to not enter the next steps and end

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
  • Possible duplicate of [Link](https://stackoverflow.com/questions/37978957/route-the-path-of-the-script-depending-on-the-button-pressed-mshta-exe-vbscript) –  Aug 26 '19 at 12:45

1 Answers1

0
@ECHO OFF
SETLOCAL
echo x=msgbox("By performing this action you will lose access to the Vault, however you can regain access using the Vault Key. Are you sure you want to lock the Vault?" ,vbYesNo, "Lock Confirmation") > msgbox.vbs
ECHO WScript.echo x>>msgbox.vbs

FOR /f %%a IN ('cscript msgbox.vbs') DO SET response=%%a

IF %response%==6 (ECHO "Yes" button selected)
IF %response%==7 (ECHO "No" button selected)
GOTO :EOF

This worked for me.

Why 6 and 7 ? Beats me.

Magoo
  • 77,302
  • 8
  • 62
  • 84