
現在、次の操作を実行しています。ダブルクリックするだけで実行できる .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"