행위

Powershell

DB CAFE

thumb_up 추천메뉴 바로가기


  • .bat두 번 클릭하면 관리자 권한으로 powershell 스크립트를 실행 하는 배치 파일 ( )을 만들 수 있습니다 . 이 방법으로 powershell 스크립트에서 아무것도 변경할 필요가 없습니다. 이렇게하려면 powershell 스크립트의 이름과 위치가 같은 배치 파일을 만든 후 다음 내용을 입력하십시오.
@echo off

set scriptFileName=%~n0
set scriptFolderPath=%~dp0
set powershellScriptFileName=%scriptFileName%.ps1

powershell -Command "Start-Process powershell \"-ExecutionPolicy Bypass -NoProfile -NoExit -Command `\"cd \`\"%scriptFolderPath%\`\"; & \`\".\%powershellScriptFileName%\`\"`\"\" -Verb RunAs"