A tiny set of batch scripts that make Windows CMD feel a bit more like Linux. I made these back when I started using wsl and in vs code terminals so feel free to modify them as you like to suit your system and needs :)
- touch — Create a file if it doesn’t exist, or update its modified time.
touch file.txt touch a.txt b.txt c.txt
-
ls — List files with a few familiar flags:
-a
(show hidden/system)-l
(long listing: owner, timestamp)-al
/-la
(combine)-R
(recursive)
ls ls -l ls -a ls -al C:\Windows ls -R .
-
cat — Print one or more files. With no args, reads from stdin (end with
Ctrl+Z
then Enter).cat file.txt cat a.txt b.txt type some_command_output | cat
-
clear — Clear the console.
clear
-
ll (optional) — Shortcut for
ls -al
in the current directory.ll
-
pwd — print working directory
pwd
-
mv — move/rename;
-f
to overwrite
mv old.txt new.txt
mv -f file.txt C:\dest\
-
cp — copy files; use
-r
for directories,-f
to overwrite
cp a.txt b.txt
cp -r srcDir C:\destDir\
(Usesrobocopy
for directories.) -
rm — remove files;
-r
for directories;-f
to force/suppress prompts
rm file.txt
rm -r folder
rm -rf build
Safety: refuses to operate on drive roots like
C:\
.
-
Create a folder for your scripts (recommended):
C:\cmd-aliases\
-
Save these files into that folder:
touch.bat
ls.bat
cat.bat
clear.bat
- (optional)
ll.bat
-
Add the folder to your PATH (one-time):
setx PATH "%PATH%;C:\cmd-aliases"
Open a new CMD window after this step so the updated PATH is picked up.
-
Test:
touch hello.txt ls -al cat hello.txt clear
- These scripts are designed for CMD. PowerShell users can create native functions/aliases instead.
touch.bat
uses PowerShell under the hood (available on Windows 10/11) to reliably update the modification time without altering file contents.ls.bat
is intentionally minimal. Windowsdir
doesn’t exactly match Unixls
output formatting, but the common flags above are mapped to sensibledir
switches.
- Remove the
.bat
files and (optionally) removeC:\cmd-aliases
from your PATH via System Properties → Environment Variables.