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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Accept value in Batch files on NT

Reply to Message Icon

Name: salil
Date: January 24, 2003 at 06:45:19 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: Maurice Reed
Date: January 24, 2003 at 08:51:27 Pacific
Reply:

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



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows NT Forum Home


Sponsored links

Ads by Google


Results for: Accept value in Batch files on NT

TCP/IP configuration using a batch file on NT Workstation www.computing.net/answers/windows-nt/tcpip-configuration-using-a-batch-file-on-nt-workstation/7275.html

NT Batch files www.computing.net/answers/windows-nt/nt-batch-files-/8403.html

How to take backup of the registry files on NT system www.computing.net/answers/windows-nt/how-to-take-backup-of-the-registry-files-on-nt-system/8921.html