Skip to content

Instantly share code, notes, and snippets.

@negokaz
Last active September 13, 2023 09:50
Show Gist options
  • Save negokaz/ecd9e6ae86aa13c871aa900b75f26c7d to your computer and use it in GitHub Desktop.
Save negokaz/ecd9e6ae86aa13c871aa900b75f26c7d to your computer and use it in GitHub Desktop.
Execute PowerShell script which has same name
@echo off
powershell -NoProfile -ExecutionPolicy RemoteSigned ^
"Start-Process powershell.exe -ArgumentList %~dp0\%~n0.ps1 -WindowStyle Hidden"
@echo off
rem run as Administrator
powershell -NoProfile -ExecutionPolicy RemoteSigned ^
"Start-Process powershell.exe -Verb runas -ArgumentList %~dp0\%~n0.ps1 -WindowStyle Hidden"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment