Windows Sysinternals Disk Usage Batch File

command_prompt

October 23, 2015 | Posted in Commant Prompt

Batch file single:

@echo off
CD “C:\”

For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%a-%%b)
For /f “tokens=1-3 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%b-%%a)
For /f “tokens=1-2 delims=/:” %%a in (‘time /t’) do (set mytime=%%a%%b)
echo Started scan at %mydate%_%mytime%

c:\du.exe -c “\\servername\directory”

For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%a-%%b)
For /f “tokens=1-3 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%b-%%a)
For /f “tokens=1-2 delims=/:” %%a in (‘time /t’) do (set mytime=%%a%%b)
echo Finished scan at %mydate%_%mytime%

pause

 

Batch file multi:

@echo off
CD “C:\”

For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%a-%%b)
For /f “tokens=1-3 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%b-%%a)
For /f “tokens=1-2 delims=/:” %%a in (‘time /t’) do (set mytime=%%a%%b)
echo Started scan at %mydate%_%mytime%

for %%i in (
“\\servername\directory”
“\\servername\directory”
) do C:\du.exe -c %%i

For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%a-%%b)
For /f “tokens=1-3 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c-%%b-%%a)
For /f “tokens=1-2 delims=/:” %%a in (‘time /t’) do (set mytime=%%a%%b)
echo Finished scan at %mydate%_%mytime%

pause

 

For more information on du.exe see https://technet.microsoft.com/en-gb/sysinternals/bb896651.aspx

Read More →

How To See Which Ports Are Listening

command_prompt

April 11, 2014 | Posted in Commant Prompt

netstat -an | find /i “listening”

Read More →