CMD bat 파일: 디스크에 쓰지 않고 Start-Process 명령을 사용하여 PowerShell 스크립트를 실행하는 방법은 무엇입니까?

CMD bat 파일: 디스크에 쓰지 않고 Start-Process 명령을 사용하여 PowerShell 스크립트를 실행하는 방법은 무엇입니까?

저는 현재 다음을 수행하고 있습니다. 두 번 클릭하면 실행할 수 있는 .bat 파일이 있습니다. 명령을 사용하여 또 다른 bat 파일을 생성한 후 powershell -command "Start-Process elevated.ps1 -Verb runas"해당 스크립트에 대한 관리자 권한을 요청하기 위해 실행됩니다. 내 .bat 파일은 다음과 같습니다.

@ECHO OFF
Rem Write the command to file and run as elevated
echo powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('https://s3.eu-central-1.amazonaws.com/xyz/somescript.ps1')" > elevated.ps1
powershell -command "Start-Process elevated.ps1 -Verb runas"

디스크에 쓰는 부분을 건너뛰고 싶기 때문에 기본적으로 다른 스크립트를 다운로드하여 실행하는 명령을 실행하고 싶습니다. 나는 다음과 같은 것을 찾고 있습니다 :

powershell -command "Start-Process 'the long command here somehow' -Verb runas"

관련 정보