"Run with PowerShell" feature doesn't work on Windows 7 - by Aleksandar Nikolić

Status : 

 


5
0
Sign in
to vote
ID 775161 Comments
Status Active Workarounds
Type Bug Repros 2
Opened 12/26/2012 4:11:35 PM
Access Restriction Public

Description

"Run with PowerShell" feature runs as expected on Windows 8 computer. If we compare Registry value that defines a command that runs when we select "Run with PowerShell" on a contextual menu, we can see that commands are quite different. Why it fails on Windows 7 (and probably Server 2008/2008 R2; I haven't tested that)? -File and -Command parameters cannot be used in the same command.

On Windows 8:
C:\PS> Get-ItemProperty REGISTRY::HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0\Command | Select -Expand "(default)"

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -Command "if((Get-ExecutionPolicy ) -ne 'AllSigned'){ Set-ExecutionPolicy -Scope Process Bypass }; & '%1' %*

On Windows 7:
 PS C:\> Get-ItemProperty REGISTRY::HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0\Command | Select -Expand "(default)"

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1" "-Command" "if((Get-ExecutionPolicy ) -ne AllSigned) { Set-ExecutionPolicy -Scope Process Bypass }"
Sign in to post a comment.