User Tools

Site Tools


windows_batch_scripting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
windows_batch_scripting [2015/08/04 20:16] – add "Get current time in a locale independent way" zertrinwindows_batch_scripting [2015/08/04 20:18] (current) – add "Delete folders older than 10 days" zertrin
Line 126: Line 126:
 FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
 set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
 +</code>
 +
 +
 +==== Delete folders older than 10 days ====
 +
 +from http://stackoverflow.com/questions/5497211/batch-file-to-delete-folders-older-than-10-days-in-windows-7
 +
 +<code>
 +FORFILES /S /D -10 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"
 </code> </code>
  
windows_batch_scripting.txt · Last modified: by zertrin