batch files and incrementin environment vars
#2
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
does it have to be a batch file or can you use windows scripting host??
Probably is possible though.
David
Probably is possible though.
David
#3
I'd prefer a batch file. I already have a batch fle to run a java program, but each time you run it it needs a different port number supplied. Previously it would only be run once, but now I am testing multi session/user stuff, and I would prefer not to have 5 different bat kicking around which are identical apart from this port number.
Chris
[Edited by Chris J - 5/24/2002 3:43:03 PM]
Chris
[Edited by Chris J - 5/24/2002 3:43:03 PM]
#4
Moderator
iTrader: (2)
Every time you run the prog, create a file called 1234.fil (empty)
Enviro used that number but adds a number to the .fil, then del *.fil, then create .fil with the same number as the one in just used by the enviro.
Well clumsy, but you could run a menu option to check the .fil number to see if it was in range that you specified, then either delete & start from the bottom number or just add on.
Its Friday & I have a large headache
Enviro used that number but adds a number to the .fil, then del *.fil, then create .fil with the same number as the one in just used by the enviro.
Well clumsy, but you could run a menu option to check the .fil number to see if it was in range that you specified, then either delete & start from the bottom number or just add on.
Its Friday & I have a large headache
Trending Topics
#8
What OS? The NT resource kit has the setx command which sets env variables permanently, they are then available to future command windows but not the current one.
I'd have thought some variation on Puff's suggestion would be possible, although I haven't got the faintest idea what he was talking about
I'd have thought some variation on Puff's suggestion would be possible, although I haven't got the faintest idea what he was talking about
#10
Moderator
iTrader: (2)
I'll have a basic go @ trying to explain myself...
exist file.* ? [* should be a file extension made up of a the numbers that corespond to the port numbers but in this case its just checking that there is a file]
if yes, use the number of the highest file extension +1 as the enviromental variable for port number
copy file.* number to file.(whatever the new enviromental variable number is)
run java program port: whatever the new enviromental variable number is
end
if no, copy file.xxx to file. [number before 1st avail port no:]
then repeat the first steps.
If there is a finate number to ports
exist file.[max no]?
if yes, delete *.fil (that aren't locked as being part of the batch process?) and run the middle section (OK not in the correct order of process) but that will loop the port numbers back to the start.
Only prob I see is if with limited ports there may be a user already in session on that port, in which case, how about running the java app as part of the dos shell (if poss) so that its only when it ends, it then deletes the enviromental variable or port number file it created before it completely ends its session.
[Edited by Puff The Magic Wagon! - 5/24/2002 5:36:34 PM]
exist file.* ? [* should be a file extension made up of a the numbers that corespond to the port numbers but in this case its just checking that there is a file]
if yes, use the number of the highest file extension +1 as the enviromental variable for port number
copy file.* number to file.(whatever the new enviromental variable number is)
run java program port: whatever the new enviromental variable number is
end
if no, copy file.xxx to file. [number before 1st avail port no:]
then repeat the first steps.
If there is a finate number to ports
exist file.[max no]?
if yes, delete *.fil (that aren't locked as being part of the batch process?) and run the middle section (OK not in the correct order of process) but that will loop the port numbers back to the start.
Only prob I see is if with limited ports there may be a user already in session on that port, in which case, how about running the java app as part of the dos shell (if poss) so that its only when it ends, it then deletes the enviromental variable or port number file it created before it completely ends its session.
[Edited by Puff The Magic Wagon! - 5/24/2002 5:36:34 PM]
Thread
Thread Starter
Forum
Replies
Last Post