I am trying to add the following yes/no box into a batch file but keep failing.
Set objShell = CreateObject("Wscript.Shell")
intMessage = Msgbox("Would you like to go to URL?", _
vbYesNo, "Click yes to go to URL")
If intMessage = vbYes Then
objShell.Run("http://www.url.com")
Else
Wscript.Quit
End If
Can anyone point me in the right direction please?
@echo off
call :MsgBox "Would you like to go to URL?" "VBYesNo+VBQuestion" "Click yes to go to URL"
if errorlevel 7 (
echo NO - don't go to the url
) else if errorlevel 6 (
echo YES - go to the url
start "" "http://www.google.com"
)
exit /b
:MsgBox prompt type title
setlocal enableextensions
set "tempFile=%temp%\%~nx0.%random%%random%%random%vbs.tmp"
>"%tempFile%" echo(WScript.Quit msgBox("%~1",%~2,"%~3") & cscript //nologo //e:vbscript "%tempFile%"
set "exitCode=%errorlevel%" & del "%tempFile%" >nul 2>nul
endlocal & exit /b %exitCode%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With