Delete all files of specific type (extension) recursively down a directory using a batch file

You can use wildcards with the del command, and /S to do it recursively. del /S *.jpg Addendum @BmyGuest asked why a downvoted answer (del /s c:\*.blaawbg) was any different than my answer. There’s a huge difference between running del /S *.jpg and del /S C:\*.jpg. The first command is executed from the current location, … Read more

More lines in command window

At least in Win7, Kristina’s answer now seems to be either its memory of commands typed in the command lines, or the amount you can copy-paste. To increase the scrollbar’s memory, I did the following: Go to properties as mentioned by Kristina Go to the layout tab (that’s the third one) Modify the screen buffer … Read more

Running CMD command in PowerShell

Try this: & “C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe” PCNAME To PowerShell a string “…” is just a string and PowerShell evaluates it by echoing it to the screen. To get PowerShell to execute the command whose name is in a string, you use the call operator &.

Delete a directory and its files using command line but don’t throw error if it doesn’t exist

Redirect the output of the del command to nul. Note the 2, to indicate error output should be redirected. See also this question, and especially the tech doc Using command redirection operators. del {whateveroptions} 2>null Or you can check for file existence before calling del: if exist c:\folder\file del c:\folder\file Note that you can use … Read more