Computing.Net > Forums > Windows 2000 > Assig option selected in cmd to %4

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.

Assig option selected in cmd to %4

Reply to Message Icon

Name: sony_tj
Date: August 28, 2007 at 23:07:19 Pacific
OS: Windows 2000
CPU/Ram: 506,600 KB
Product: IntelR Pentium
Comment:

@echo off
echo
:start
cls
echo.

if "%3" == "" goto first
if "%3" == "wp" goto second
if "%3" == "pp" goto second

:second
echo Select Option
echo 1 -- ac -- xxx
echo 2 -- pg -- yyy
echo 3 -- Exit
echo.
CHOICE /N /C:123 ENTER OPTION [1-3] %4
echo.
if errorlevel == 3 goto end
if errorlevel == 2 goto second_pg
if errorlevel == 1 goto second_ac

beeb
echo.
echo.
goto end

:second_ac
java -jar \\aaa\bbb\ccc\ddd\eee.jar %2 %1
goto end

:second_pg
java -jar \\aaa\bbb\ccc\ddd\eee.jar %2 %3 %1
goto end

:end
@echo on

%1, %2 and %3 are the parameters I am passing from my command prompt and am able to assign the same to a string in my Java code. But %4 is the option which I am selecting in my command prompt and am not able to catch the same in my Java code. Please tell me how do I assign %4 to a string, like for instance

1. When I select %4 in my command prompt as ENTER OPTION [1-3] 1, then I should assign ac to %4
2. When I select %4 in my command prompt as ENTER OPTION [1-3] 2, then I should assign pg to %4

Could anyone please tell me how do I do this.

sony_tj



Sponsored Link
Ads by Google

Response Number 1
Name: os2fan2
Date: September 2, 2007 at 23:54:52 Pacific
Reply:

You can't assign variables like %4 by way of set. What one might do is something like set the variable to something like T4.

eg
set T1=%1
set T2=%2
set T3=%3
set T4=%4

It will then work with these variables.

I normally use variables beginning in Y for temporary variables, since it is elsewise out of use.

You then get java or something to read the variable from the CMD environment.

The dream you dream alone is only a dream,
The dream we dream together is reality.


0
Reply to Message Icon

Related Posts

See More


Logon Loop redeploy sp4 group policy



Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Assig option selected in cmd to %4

Quirk in selecting in W2K www.computing.net/answers/windows-2000/quirk-in-selecting-in-w2k/50098.html

Multiple NICs in WIN2k to increase throughput? www.computing.net/answers/windows-2000/multiple-nics-in-win2k-to-increase-throughput/7723.html

Fatal Errors in Mechanical Desktop 4 running under Windows 2000 www.computing.net/answers/windows-2000/fatal-errors-in-mechanical-desktop-4-running-under-windows-2000/5375.html