Skip to content

Windows Scripting

  • by

Here are some helpful script commands for batch files:
@echo off
cd c:\temp
set folder=%date:~10,4%%date:~7,2%%date:~4,2%
mkdir %folder%
move c:\temp c:\%folder%

md “C:\BACKUP %DATE%\”

rmdir “C:\Program Files\Adobe”
rmdir “C:\Program Files\Test Folder” /S /Q

The S switch forces the deletion of all files within the working directory
without asking the user, and the Q switch deletes the folder without asking
the user whether they are sure or not.

Here is the help text for the remove directory command.

Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S