Computing.Net > Forums > Windows NT > Accept value in Batch files on NT

Accept value in Batch files on NT

Reply to Message Icon

Original Message
Name: salil
Date: January 24, 2003 at 06:45:19 Pacific
Subject: Accept value in Batch files on NT
OS: Windows NT 4.0
CPU/Ram: 1/256 MB
Comment:

Hi,

I am developing a Batch file to accept values at the the ime of execution and then call respective batch files based on the input given by the user, I actually u have developed a small script to do this, but when i execute it, the batch file halts to accept value but doesn't respond to any key but ^Z for termination of batch process. I am attaching below the script I have written:

@echo off
cls
echo 1. Upgrade Existing 1
echo 2. Upgrade Existing 2
echo 3. Apply all patches
echo 4. Quit

echo Choose your selection
echo.

:choice
set /p choice=[1,2,3,4]?

if /I "%choice%"=="1" goto patch60_601
if /I "%choice%"=="2" goto patch601
if /I "%choice%"=="3" goto patch522_60_601
if /I "%choice%"=="4" goto end
goto choice

:patch60_601
@echo installing SRM52RCK Patch
@echo:
call 522\SRM52RCKPatch.bat

goto end

:patch601
@echo installing CX601 Patch
@echo:
call 601\CX601Patch.bat

goto end

:patch522_60_601
cls
@echo installing SRM52RCK Patch
@echo:
call 522\SRM52RCKPatch.bat
@echo:
@echo installing CX601 Patch
@echo:
call 601\CX601Patch.bat

goto end

:end
@echo:
@echo done


Report Offensive Message For Removal


Response Number 1
Name: Maurice Reed
Date: January 24, 2003 at 08:51:27 Pacific
Subject: Accept value in Batch files on NT
Reply: (edit)

I think what's confusing things is using the word choice as a label as choice is a keyword in the set statement try change the label to something else like this extract below:-

:option
set /p choice=[1,2,3,4]?

if /I "%choice%"=="1" goto patch60_601
if /I "%choice%"=="2" goto patch601
if /I "%choice%"=="3" goto patch522_60_601
if /I "%choice%"=="4" goto end
goto option



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Accept value in Batch files on NT 

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge