Tag Archives: cmd.exe

CMD.EXE: About Variables

      Comments Off on CMD.EXE: About Variables

In this article I will give some extra information on the usage of CMD.EXE variables in batch files. These variables are stored in the so-called Environment, hence the name Environment Variables. There are two environments on a Windows machine: The System and the User environment. When a variable is set… Read more »

Reghack: DosHere, but on files too!

      Comments Off on Reghack: DosHere, but on files too!

Annoying: You want a command shell, but there is no folder in view in the Windows Explorer, just the files in the folder you want the shell to start in. This is a modified version of the DosHere.reg file that allows just that by right-clicking on any file system object:… Read more »

CMD.exe recursion in batch: Deleting empty subdirectories

      Comments Off on CMD.exe recursion in batch: Deleting empty subdirectories

This article addresses one specific use case for recursion in batch: Recursively looping through a directory (also called a folder) and its sub directories. Normally, this is a pain, and it took me a while to come up with an algorithm that works. For recursion to work correctly, you need:… Read more »

Cmd.exe: Workaround for “if not exist *.*” and other uses for the FOR command

      Comments Off on Cmd.exe: Workaround for “if not exist *.*” and other uses for the FOR command

One of the annoying things in Windows XP/2003 and later, is that the construct if not exist c:\test\*.* echo No files! does not work as expected if c:\test is empty. This seems to be due to the fact that Windows regards the “.” and “..” file entries as valid files… Read more »