It’s been a month since I am here and for a month I have been working on Win2K at my office. Haven’t seen Linux in loooong time. Missing it, especially today.
Today I needed to do some scripting in Windows, for some personal work. Due to inefficiency in finding some advanced features for wget and in the presence any good download manager, I needed to shift towards this scripting. Oh God, What an unfortunate soul. Need to work in windows and that too with scripting. After coming to real world (read industry) I started loving linux more, you know why? because here you can’t use pirated softwares any more and this is not IITK, where you just switch on your DC++ and download any bloody software within seconds. Thought, Let’s take a dive and at unfortunate moment started scripting.
Now, I needed to make a FOR loop. After trying out different keywords found out following command
FOR %%e IN (1 2 3 4 5 6) DO …
Now why would you need to type two ‘%’ to mark a variable?? Anyways, this command will run for six time take value from 1 to 6. Now what would you do if you need to run loop for say 100 times are you going to write (1 2 3 … 100). Well, you have to, I couldn’t find any other technique. So thought let’s try some another technique, something similar to while loop, implement using notorious GOTO. Now the question was how to set a variable and use it. tried out various combination
i=100
%i=100
%%i=100
…
Neither worked and suddenly remembered good old days where somehow I studied AUTOEXEC.BAT and they used something like SET for setting a variable. %$@@#$%%@$#. What the hell? why to type something extra as SET, I bet even Bill Gates won’t be able to tell you that. Don’t lose the spirit, go ahead. I thought. Now, came the next ultimate question, how to increment a variable? again combinations…
i=%i+1
i=%%i+1
%%i=%i%+1
…
Again, no luck. There exists something like INCR in dos, but for some reason that won’t work in Win2K, so here is where I am stuck up. No clue to get out of this. Don’t think I didn’t Google for any of this stuff. After hard work on Google, I am pouring out my frustration here. Should get back to search now I guess. God bless me!!
Recent breakthrough : Finally managed to find out the way to increment a variable. it goes
SET /A i += 1
Now don’t ask me why to put extra /A for doing so, in one other achievement, I found out that IF syntax would be like
IF NOT “i”=”100”
but I am still unaware about use of in IF, because if I use those, it says unexpected end of statement or something like that. Let it be whatsoever it is, I am done with my job. After I was done with my download thing, I am enjoying the geeky strips I downloaded and sharing one which is very pertinent with this one.