[12.20.0207] "Run With PowerShell" Failing

Things you’d like to miss in the future...
Forum rules
When reporting a bug, please include the following information: your XYplorer version (e.g., v27.90.0047), your Windows version (e.g., Win 11), and your screen scaling percentage (e.g., 125%). We recommend adding your Windows version and screen scaling percentage to your profile or signature. This will make debugging much easier for us.
Post Reply
EnjoyRC
Posts: 101
Joined: 08 Nov 2010 21:54

[12.20.0207] "Run With PowerShell" Failing

Post by EnjoyRC »

If I browse to a directory with Win Explorer, and right click a PS1 file, I get an option "Run With PowerShell".. and all is good.
In XY, I right click a PS1 file, I again see the "Run With PowerShell" option. But it fails.
Yes, I have set ExecutionPolicy to Unrestricted. :) Works just fine from Explorer. Any ideas?

Code: Select all

File .... cannot be loaded because the execution of the scripts is disabled on this system.  Please see "get-help about_signing" for more details.
+ CategoryInfo...
+FullyQualifiedErrorId : RuntimeException.

admin
Site Admin
Posts: 64877
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [12.20.0207] "Run With PowerShell" Failing

Post by admin »

Run XY as admin?

EnjoyRC
Posts: 101
Joined: 08 Nov 2010 21:54

Re: [12.20.0207] "Run With PowerShell" Failing

Post by EnjoyRC »

admin wrote:Run XY as admin?
As per your suggestion, just right clicked XYplorer and selected "Run as Administrator".
Then when trying to (right click / run with powershell) on a file, I still get the same error.

admin
Site Admin
Posts: 64877
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [12.20.0207] "Run With PowerShell" Failing

Post by admin »

And when you login as admin?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [12.20.0207] "Run With PowerShell" Failing

Post by TheQwerty »

I cannot say I understand exactly what is happening, but it seems like it is another x64 annoyance.

If you go into the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\0\Command

And change the value of "(Default)" from the System32 path to a SysNative path it should work correctly in XY but seems to break WE.

I would think you should be able to get it working in both by adding entries under:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes
but I'm not having any luck with my attempts, so I might be flat out wrong.


EDIT: A kludgey fix would be to add a second "Run with Native PowerShell" command that would work in XY but not in Windows Explorer.

To do that in the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\
  1. Create a new key; its name doesn't seem to matter but I went with "1".
  2. Under our new "1" key change the value of "(Default)" to whatever you want displayed in the context menu. I'm hungry and called mine "Taco", but "Run with Native PowerShell" might be more informative.
  3. Under the "1" key create a new key named "Command".
  4. Under "Command" change the value of "(Default)" to the SysNative version of the value of ".\0\Command\(Default)".
Now when you right click a PS1 there will be two "Run with ..." commands one that works in 64-bit programs and another that should work in 32-bit ones (though using the 64-bit PowerShell not the 32-bit one).


There is probably a better, or at least cleaner, solution, but this is the first one I stumbled upon.

Post Reply