Skip to content

Instantly share code, notes, and snippets.

@hunandy14
Last active September 29, 2023 05:41
Show Gist options
  • Save hunandy14/6a290cc77609c13a899b9a6e0801d008 to your computer and use it in GitHub Desktop.
Save hunandy14/6a290cc77609c13a899b9a6e0801d008 to your computer and use it in GitHub Desktop.
PowerShell 與 Bat 的混合代碼
@(set "0=%~f0"^)#) & set "1=%*" & setlocal enabledelayedexpansion & powershell -nop -c "iex([io.file]::ReadAllText($env:0));$Host.SetShouldExit($LastExitCode);Exit $LastExitCode" & exit /b !errorlevel!
Write-Host "by PSVersion::" $PSVersionTable.PSVersion
Write-Host "Command is '$env:0 $env:1'"
Exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment