Answer» hi. first post. thanks for reading: im trying to do some super simple scripting in winxp. total novice stuff. i think i have the basic idea of batch scripts under my belt and ive made two of them that ALTERNATELY turns on and off a setting in the registry (i exported the reg key and added a rundll32 command and it works). but i want to make a single shortcut that will toggle the setting on/off from one icon. whats the best way to do it? also, is there something i can add so that it runs invisibly (without opening a cmd shell window, as it does now)? apologies for the vague SUBJECT header but i dont really know... thanks! There is no logic in a shortcut. Sounds like you're trying to move the logic of the batch file(s) to the shortcut.
Do you have a single batch file toggle on if off and toggle off if on? If so you're OK; create one shortcut for the single batch file.
Do you have one batch file to toggle on and another batch file to toggle off? If so you're SOL. One batch file can have many shortcuts, but shortcuts are limited to launching a single run unit.
If you have two files, TRY combining the logic into a single file and get user input at runtime to determine whether to toggle on or toggle off.
If you need additional help, please mention your OS. He is running XP.thanks for the quick reply- yes i have *two* .bat files. one turns the setting on and one turns it off. right now i have to run the one, then the other. but what i want is a single file to toggle the setting. yes i realize right now i cant make a shortcut.. thats why i want to make the single file.
and yes i am running xp pro sp2. i have no idea how to implement your suggestions..
also- is there a way to make a batch cmd run invisibly so the user doesnt see a cmd shell window?If you combine the two batch files together, you'd need either an external value to indicate which way to toggle the setting or an internal value generated by the batch file.
The external method would defeat the idea of one shortcut to run both situations.
One method useful for the internal method would be to check the setting value (on or off) and set a variable. The batch file could then check the variable and flip the setting accordingly.
The command shell cannot be eliminated entirely as you need an interpreter for the batch file, but it can be MINIMIZED and closed automatically.
Hope this gives you some ideas 8-)
|