Created
March 8, 2022 22:58
-
-
Save mark05e/3d8c7e00a75f371075f738cf7d086ff1 to your computer and use it in GitHub Desktop.
Launch Powershell Script with same name in the same path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::==================================================================== | |
:: Powershell script launcher | |
:: ref: https://stackoverflow.com/questions/10137146/is-there-a-way-to-make-a-powershell-script-work-by-double-clicking-a-ps1-file | |
::===================================================================== | |
:MAIN | |
@echo off | |
for /f "tokens=*" %%p in ("%~p0") do set SCRIPT_PATH=%%p | |
pushd "%SCRIPT_PATH%" | |
powershell.exe -sta -c "& {.\%~n0.ps1 %*}" | |
popd | |
set SCRIPT_PATH= | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment