Skip to content

Instantly share code, notes, and snippets.

@Serat00l951
Last active June 11, 2022 12:29
Show Gist options
  • Save Serat00l951/63dc2e9c34fe4e093f544b0afa7bbf20 to your computer and use it in GitHub Desktop.
Save Serat00l951/63dc2e9c34fe4e093f544b0afa7bbf20 to your computer and use it in GitHub Desktop.
Start powershell scripts with double click
rem Run this with admin rights!
rem Запускать от имени администратора!
powershell -command "& {Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force}"
ftype Microsoft.PowerShellScript.1="C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe" "%%1"
assoc .ps1=Microsoft.PowerShellScript.1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ps1" /f
reg add "HKCR\Microsoft.PowerShellScript.1\shell\runas" /f
reg add "HKCR\Microsoft.PowerShellScript.1\shell\runas" /v "HasLUAShield" /t REG_SZ /f
reg add "HKCR\Microsoft.PowerShellScript.1\shell\runas\command" /f
reg add "HKCR\Microsoft.PowerShellScript.1\shell\runas\command" /ve /t REG_SZ /d "\"C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe\" \"%%1\"" /f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment