Windows Batch Programming Question

Yo-Yo

Member
I need some help with a batch script I am writing. I have a variable %INPUT% and I need to add 1 to it. I have a loop set up with a lable/goto. So for example it is set by the user to 1000 and it needs to have 1 added to it every loop. Please help me out. Thanks.
 
I haven't done any windows batch work in a while, but i believe it is(or something close to):
set /a INPUT=%INPUT%+1
 
Just fixed it. For reference SET /a INPUT=INPUT + 1 worked.

I have another question now. How can have the batch I open a file browser to select a file for it to work with?
 
well just explorer will open up a browser to look through files, but I've never seen anyone use a actual file browser to select a file to work with. Usually you just write the path to the file.
 
I'm trying to make it easier for users to select file paths instead of typing it all in. I might switch to visual basic and make a GUI for all this. Right now I'm trying to get a numbered menu (i.e. press 1 for X option, press 2 for Y option).
 
You can't open a GUI element for input in a batch file. They are meant to automate command line operations.
 
meh... ok. Is there a way I can make the batch file "figure out where it is" and run the script from that directory? An example would be opening the files in the folder it is placed in.
 
ooo, found it! for reference--

cd /d %~dp0

that will bring you to the directory you're running the batch from. Yay, my little batch is done now!
 
Back
Top