Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Created June 4, 2025 06:26
Show Gist options
  • Save raspberrypisig/e880e35899c91c59cae640915875a139 to your computer and use it in GitHub Desktop.
Save raspberrypisig/e880e35899c91c59cae640915875a139 to your computer and use it in GitHub Desktop.
# Ensure PowerShell is run as Administrator
$CoreUtils = "C:\Users\<user>\AppData\Local\Microsoft\WinGet\Links\coreutils.exe"
$commands = @(
'arch', 'b2sum', 'b3sum', 'base32', 'base64', 'basename', 'basenc', 'cat',
'cksum', 'comm', 'cp', 'csplit', 'cut', 'date', 'dd', 'df', 'dir',
'dircolors', 'dirname', 'du', 'echo', 'env', 'expand', 'expr', 'factor',
'false', 'fmt', 'fold', 'hashsum', 'head', 'hostname', 'join', 'link',
'ln', 'ls', 'md5sum', 'mkdir', 'mktemp', 'more', 'mv', 'nl', 'nproc',
'numfmt', 'od', 'paste', 'pr', 'printenv', 'printf', 'ptx', 'pwd',
'readlink', 'realpath', 'rm', 'rmdir', 'seq', 'sha1sum', 'sha224sum',
'sha256sum', 'sha3-224sum', 'sha3-256sum', 'sha3-384sum', 'sha3-512sum',
'sha384sum', 'sha3sum', 'sha512sum', 'shake128sum', 'shake256sum',
'shred', 'shuf', 'sleep', 'sort', 'split', 'sum', 'sync', 'tac', 'tail',
'tee', 'test', 'touch', 'tr', 'true', 'truncate', 'tsort', 'uname',
'unexpand', 'uniq', 'unlink', 'vdir', 'wc', 'whoami', 'yes'
)
#$CommandOutput = & coreutils --list
$LinksDirectory = "C:\tools"
foreach ($CommandName in $commands) {
Write-Output "creating symbolic link $CommandName"
$LinkFilePath = Join-Path -Path $LinksDirectory -ChildPath "$CommandName.exe"
Write-Output " Link Path: $LinkFilePath"
Write-Output " Target: coreutils.exe $CommandName"
New-Item -ItemType SymbolicLink -Path $LinkFilePath -Value $CoreUtils -Force -ErrorAction Stop
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment