Jump to content

Recommended Posts

Posted

im wanting 2 have a popup which asks a question & only use 1 cmd file

example

have an autoit script popup & ask if i want to enable or Disable something & have it "goto Yes" or "Goto No" like u would in a batch file with the prompt command

see what i mean? lol i get confused even trying 2 explain it :P


Posted

@echo off

:START
CLS
SET /P var1=Would you like to enable something?
SET var1=%var1:~0,1%
IF /I %var1%==y (goto YES)
IF /I %var1%==n (goto NO)
GOTO START

:YES
echo YES
GOTO END

:NO
echo NO
GOTO END

That should do it...

Posted

yes, i know how 2 do it with a prompt via cmd file..

but what im wanting 2 do, is have the message window instead of entering y/n in a cmd file

but im looking 4 a way 2 have the message window (autoit) pass the "goto yes/no" to the batch file

Posted

ya, thanks . after i posted i searched :P seems to work well, except its OK/Cancel instead of Yes/No :P but ohwell :P

Posted (edited)

This Is A Cmd That Outputs A YesNo Vbs Than Will

Return What The User Selected.

Blue The Vbs Out File

Green Is Where The Yes reply

Red Is The No Reply

Purple The Varible That Get Passed Between The Scripts

echo off && cls && mode 55,3 && color f3 && Title Gunsmokingman Cmd To Vbs Back To Cmd

set P1=Ping -n 1 127.0.0.1

set P3=Ping -n 3 127.0.0.1

set VBS01=%systemdrive%\YN.vbs

set Cmd1=%systemdrive%\Temp.cmd

> %VBS01% Echo Set Action = CreateObject("Wscript.Shell")

>> %VBS01% Echo SD = Action.ExpandEnvironmentStrings("%SystemDrive%")

>> %VBS01% Echo YesNo = Msgbox(SPACE(7) ^& "Some Text message" ^& vbcrlf ^& "Another Text Message" ^& vbcrlf ^&_

>> %VBS01% Echo "Yes For Some Action" ^& vbcrlf ^& "No For Some Other Action" , 4 + 48,"Gsm YesNo-2cmd")

>> %VBS01% Echo If strUserIn = vbYes then

>> %VBS01% Echo Set FS = CreateObject("Scripting.FileSystemObject")

>> %VBS01% Echo strFileName =  FS.BuildPath(Wscript.ScriptFullName ^& "\..", "\Gsm YesNo-2cmd")

>> %VBS01% Echo strFileName =  FS.GetAbsolutePathName(strFileName)

>> %VBS01% Echo Set TS = FS.OpenTextFile(SD ^& "\Temp.cmd", 2, True)

>> %VBS01% Echo TS.WriteLine "set Loc=" ^& YesNo

>> %VBS01% Echo TS.Close

>> %VBS01% Echo Else

>> %VBS01% Echo Set FS = CreateObject("Scripting.FileSystemObject")

>> %VBS01% Echo strFileName =  FS.BuildPath(Wscript.ScriptFullName ^& "\..", SD ^& "\Temp.cmd")

>> %VBS01% Echo strFileName =  FS.GetAbsolutePathName(strFileName)

>> %VBS01% Echo Set TS = FS.OpenTextFile(SD ^& "\Temp.cmd", 2, True)

>> %VBS01% Echo TS.WriteLine "set Loc=" ^& YesNo

>> %VBS01% Echo TS.Close

>> %VBS01% Echo End If

%P1%>nul

START /w %VBS01%

del %VBS01%

%P1%>nul

call %Cmd1%

%P1%>nul

del %Cmd1%  && goto %Loc%

:7

cls && Color fc && Title This Is Seven

set Loc=You Said No

Echo. && Echo   %Loc% && %P3%>nul

goto Quit

:6

cls && Color f2 && Title This Is Six

set Loc=You Said Yes

Echo. && Echo   %Loc% && %P3%>nul

goto Quit

:quit

cls && Color 5e

echo. && Echo Good Bye && %P3%>nul

goto EOF

exit

Edited by gunsmokingman
Posted
but im looking 4 a way 2 have the message window (autoit) pass the "goto yes/no" to the batch file

Take a looks at "call" in Windows XP Help. You will see that you can use "call" from a batch file to start a different batch file. You can also include a label in the "Call" statement. IF supplied with a label then the batch file will start AT the label passed.

That sounds like exactly what you are looking for.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...