https://github.com/boden-c/shell-scripts
Various scripts for file management, system configuration, etc.
https://github.com/boden-c/shell-scripts
bash batch powershell shell
Last synced: about 2 months ago
JSON representation
Various scripts for file management, system configuration, etc.
- Host: GitHub
- URL: https://github.com/boden-c/shell-scripts
- Owner: Boden-C
- License: lgpl-2.1
- Created: 2025-06-20T14:15:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-10T05:02:42.000Z (12 months ago)
- Last Synced: 2025-07-10T14:18:34.612Z (12 months ago)
- Topics: bash, batch, powershell, shell
- Language: PowerShell
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Shell Scripts
Various scripts that can be easily executed in the shell for file management, system configuration, etc.
Available in
- Linux/MacOS (Bash)
- Windows (Powershell, Batch)
## Featured: Detect Process Locking File
This handy one-liner prompts for your file, automatically gets the process that is locking your file, and prompts to kill it
Windows Powershell:
```pwsh
$f=Read-Host "File";$t="$env:TEMP\h.exe";iwr https://live.sysinternals.com/handle.exe -OutF $t;& $t -accepteula $f|sls '^(\S+).*pid: (\d+)'|%{$n=$_.Matches.Groups[1].Value;$p=$_.Matches.Groups[2].Value;if((Read-Host "Kill $n ($p)? (y)")-eq 'y'){kill $p}}
```
Windows Batch (cmd):
```batch
set /p f=File: & curl -so %TEMP%\h.exe https://live.sysinternals.com/handle.exe & for /f "tokens=1,3" %a in ('%TEMP%\h.exe -accepteula %f% ^| find "pid:"') do choice /m "Kill %a (%b)" & if not errorlevel 2 taskkill /f /pid %b
```