Tuesday, May 27, 2008

Windows commands can do many tricks

The age of gurus using all kinds of Unix systems is long over. Although still not as powerful as those abracadabras, Windows does provide a set of commands for advanced users. They are not only simple extensions of the ancient DOS command, but also have grown to almost as versatile and usable as those in Unix systems.
Commandwindows.com provides comprehensive descriptions the command set. Yet, when I referred to them for iteration operations, I immediately ran into trouble.
The problem is with the command format. The example command, also from many other pages, is as follows. But I got complaints about the "%%x".
for %%X in (set) do (command)
After struggling for a while without any success, I decided to use "%x" instead. And now I got it work as expected. When I read the descriptions provided by Windows more carefully, I finally understood that "%%x" is used in a batch file, whereas "%x" is for command issued in a command window (the window by executing cmd.exe command).
This shows how difficult it can be when using system commands, the magic works that one has to input from keyboard, instead of clicking on the menus.

No comments:

Search the Web