Windows auto increment environment variable

Asked

Viewed 115 times

1

Short question

I need a variable environment in windows that is auto increment:

setx /a PORT=1000

and every time you call %PORT%:

setx /a PORT=%PORT%+ 1

the result would be:

echo %PORT%
1001
echo %PORT%
1002
echo %PORT%
1003

which begs the question,

Where to put the command ?

setx /a PORT=%PORT%+ 1


Question explained

I’m trying to debug a java applet in windows, other settings did not work, the only one that worked was

create a variety of environment

JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=2502

Only when doing this only 1 java application can be excommunicated, when trying to execute a second one error is thrown saying that the port 2502 is already in use.

my idea now is to do something like

JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=%PORT%

in which %PORT% will be an incremented number.

  • To create an environment variable the command is not setx?

  • thanks for the correction

  • I think it would be good to create a bat, to increase %PORT% and then call the applet, if I’m not mistaken it would be call c:\applet.java

  • the applet is already calling for a java web application, there is no way to change it

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.