Created
February 11, 2020 14:09
-
-
Save LivingGhost/fb2ca25a94cd794d7c78fc319885d0e3 to your computer and use it in GitHub Desktop.
Powershellスクリプトを呼び出そうとする度に調べるのは大変なので
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
@echo off | |
REM 引数1から*.ps1のファイルパスを取得 | |
set PS1_FILE_PATH=%1 | |
REM 引数1の取得に失敗した場合ユーザに入力させる | |
IF "%1" EQU "" ( | |
set /P PS1_FILE_PATH="*.ps1のファイルパス:" | |
) | |
REM *.ps1ファイル呼び出し | |
IF EXIST "%PS1_FILE_PATH%" ( | |
echo 実行: %PS1_FILE_PATH% | |
powershell -ExecutionPolicy RemoteSigned -File "%PS1_FILE_PATH%" | |
set CALL_RESULT=0 | |
) ELSE ( | |
echo ファイルパスが有効ではありません(%PS1_FILE_PATH%) | |
set CALL_RESULT=1 | |
) | |
PAUSE | |
REM 終了 | |
exit /b %CALL_RESULT% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment