Tag Archives: .bat

Underused features of Windows batch files

StackOverflow have another interesting topic about: Underused features of Windows batch files. Of course there are many things I didn’t know about. Some highlights: PUSHD path Takes you to the directory specified by path. POPD Takes you back to the … Continue reading

Posted in OS, Programming | Tagged , , , | 2 Comments

How to delete all folders in current directory

How to delete all folders in current directory using command line (cmd.exe) or batch files? How to delete all empty directories in current folder: FOR /D %f IN (*.*) DO RD “%f” How to delete all directories / folders in … Continue reading

Posted in OS, Programming | Tagged , , , | Leave a comment

Getting file size in KB using batch file

To get file size using batch file, we use variable with modifier. Then set /a, performs match operation (divide by 1024). Unlike other examples, this example works on any Windows language. @echo off :: Name: file_size.bat :: Author wishmesh.com :: … Continue reading

Posted in OS, Programming | Tagged , , , | Leave a comment

xcopy alternative for Windows Vista and Windows Server 2008 – ROBOCOPY

Robocopy – Robust File Copy for Windows is bundled with Windows Server 2008, Windows 7 and Vista. If you can not do something in xcopy, you probably can in robocopy. For example robocopy can: resume on network error, specify number … Continue reading

Posted in OS | Tagged , , | Leave a comment

Batch script to test if folder / directory is empty

Yesterday I needed a Dos batch script to check if folder is empty. A little Google search revealed some methods: Using dir and find commands, does not work on non-english Windows versions: www.computing.net Using dir command with /a-d, does not … Continue reading

Posted in OS, Programming | Tagged , , , , , | 13 Comments