Quite often we need to check which folder is taking the most space, here is one a line cmd command to do this: List folders from the smallest to the largest cmd /v /c “set zeropad=000,000,000,000,000,&for /f “delims=” %a in (‘dir /ad /b’) do @set bytes=!zeropad!000&(for /f “tokens=3” %b in (‘dir /s “%a” 2^>NUL ^|Continue reading “CMD list folders and file sizes, find the largest folders and files”
Category Archives: CMD
KILL WINDOWS STOPPING / RESTARTING SERVICE
open cmd as administrator find service PID running the next command: sc queryex servicename sc queryex “IBM Cognos” kill the process: taskkill /f /pid PID
CMD USEFUL COMMANDS
Computer full name ECHO %COMPUTERNAME%.%USERDNSDOMAIN% Computer/User domain ECHO %USERDNSDOMAIN% List domain group members NET GROUP “domain_group_name_here” /DOMAIN Display detailed configuration information about a computer and its operating system, for example, I often look at System Manufacturer: VMware, Inc. to check if I’m working on Virtual Machine or not. SYSTEMINFO Remove / delete Windows service fromContinue reading “CMD USEFUL COMMANDS”
CMD / BATCH FILE USEFUL CODE
:: check last server reboot date and time systeminfo|find “Time:” :: create empty file COPY /y NUL %filePath% >NUL :: check folder file count SET /a fileCnt=0 FOR /f “tokens=* delims= ” %%a IN (‘DIR/s/b/a-d “%folderPath%”‘) DO ( SET /a fileCnt+=1 ) IF “%fileCnt%” NEQ “0” (ECHO Some files found)