KioskeaKioskeaCommentCaMarcheSign up, it's free !
Saturday May 17, 2008 - 7:26:35 am BST

Escape Command

Search : in
Escape Command
par yuyuman
 Threaded discussions
Statut : Not resolved
Monday March 10, 2008 12:23:43 PM
Hello,

I have a batch file that FTPs data from our servers. I use a menu to have the user decide which server to log into and FTP data from. How can I code it so that at any stage in the prompts, the user can decide to go back to the main menu? This would be useful when they have already chosen a server but then realized that it is the wrong one and they need to choose a different server. Right now they are made to follow the prompts and enter bogus info just to get to the end of the script and have the ability to choose from the menu again. Is there any type of escape command that can be invoked at any time, where I can predetermine where to go when the Escape key is pressed...or something similar to that? Below is sample code of a section where currently the user has to answer the prompts before he can go back to the main menu. Thanks in advance.
:qaLOOP1
Echo Enter the TID (xxxxxx) for the Audit Dump.
Echo.
Set /P dumptid= ^>
Echo.
Echo Enter the Date (yy-mm-dd) for the Audit Dump.
Echo.
Set /P dumpdate= ^>
Echo.
Echo.
Echo The Audit Dump's TID and Date that you entered are %dumptid% and %dumpdate%.
Echo Press Y or y and then ENTER if correct or press ENTER to retry.
Echo.
Set /P answ= ^>
Echo.
Echo.
Echo.
If /I not "%answ%."=="Y." GoTo :qaLOOP1
cd c:\ftp_temp
> latest.ftp.request.txt echo o %qastratusip%
>> latest.ftp.request.txt echo %qastratususername%
>> latest.ftp.request.txt echo %qastratuspassword%
>> latest.ftp.request.txt echo bin
>> latest.ftp.request.txt echo cd audit_dumps
>> latest.ftp.request.txt echo get %dumptid%.%dumpdate%.prt
>> latest.ftp.request.txt echo bye
ftp -s:latest.ftp.request.txt
REM *****************Start of Last FTP Request Time Stamp CODE NOT IN USE***************
REM echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
REM %comspec% /e:2048 /c {a}.bat > {b}.bat
REM for %%v in ({b}.bat del) do call %%v {?}.bat
REM echo %date% %time% >> latest.ftp.request.txt
REM *****************End of Last FTP Request Time Stamp*****************

REM *****************Start of code to set date/time variables for filename*****************
@ECHO OFF
FOR /F "TOKENS=2-4 DELIMS=/ " %%a IN ("%date%") DO SET mm=%%a&SET dd=%%b&SET yy=%%c
FOR /F "TOKENS=1-3 DELIMS=:." %%a IN ("%time%") DO SET hh=%%a&SET tt=%%b&SET ss=%%c
REM echo "%yy%-%mm%-%dd% %hh%h.%tt%m.%ss%s"
REM *****************End of code to set date/time variables for filename*****************

REM *****************Start of Delay*****************
ping -n 2 localhost > nul
REM *****************End of Delay*****************

rename %dumptid%.%dumpdate%.prt AuditDump.LK%dumptid%.%dumpdate%_%yy%%mm%%dd%.%hh%%tt%%ss%.txt

REM *****************The next line is to delete the latest.ftp.request.txt file created above******
ECHO Y | DEL latest.ftp.request.txt
Set dumptid=
Set dumpdate=
Set answ=
Pause
goto qamain
Configuration: Windows XP
Internet Explorer 6.0
Reply to yuyuman  Report this message to moderators Go to last message

1


  • This message seems useful, vote!
  • Report this message to moderators
By Themask02, on Tuesday March 11, 2008 04:07:13 PM Threaded discussions 
:: ESC from menu
@echo off
setLocal EnableDelayedExpansion

:1
echo After each data point you will be asked to confirm.
echo Press Y or N
echo press Q to quit the sessiion and start over

:2
echo server? && set /p server=
echo server=!server!
choice /n /cqny
goto %errorlevel%

:3
echo ID? && set /p ID=
echo ID=!ID!
choice /n /cqxny
goto %errorlevel%

:4

echo this is 4
Reply to Themask02
Currently no message on this subject
Reply
Message title :
Your nick:
Your E-mail :
Message: 
  •  
  •  
Options: Get the answers by mail.
 

Help