In this article I want to collect useful windows shell commands.
Shell commands
Command | Description |
rename *.txt *.new_ext | Changing file name for one or more files of same file type in current directory. |
dir > print.txt | Printing all details on files like file size, name and creation date in current directory into a new file called print.txt. |
dir /b > print.txt | Printing only file names from current directory into a new file called print.txt. |
dir /s /b > print.txt | Printing only file names from current directory and all sub directories into a new file called print.txt. |
copy /a *.txt concat.txt |
Concatenates all files in current directory into one file. The /a indicates an ASCII text file. |
Power Shell commands
Command | Description |
Get-ChildItem -Filter "*current*" -Recurse | Rename-Item -NewName {$_.name -replace 'current','old' } | Rename files in batch. This does work much more reliable than using wildcards in rename in old shell commands. |