New
#1
How to set file associations in PowerShell so that .ps1 is exec by PS
How to set file associations in PowerShell so that a .ps1 Script is executed by PowerShell when double clicked.
I tried:
No error is shown when executed and the desktop is shortly after refreshed, but unfortunately the .ps1 Script is still not executed by PowerShell.Code:cmd /c "ASSOC .ps1=Microsoft.PowerShellScript.1" cmd /c "FTYPE Microsoft.PowerShellScript.1=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"" ""%1"""
I noticed underaCode:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ps1\Folder is created when one manually sets a "Open with" program. This folder contains two important entries:Code:UserChoice
But unfortunately one can't manually set a Hash since the Hash value is created automatically by Windows, so the value is kinda secret? -- additionally, the value has a different value each time, despite the a same program name.Code:1.) Hash REG_SZ wk2qS8kKVnU <- random value automatically created by Windows 2.) ProgId REG_SZ Applications\notepad.exe