Right-click .ps1 file and Run with Powershell not working

I just upgraded to Opus 12 (from Opus 11), and now when I right-click a Powershell script file (.ps1) and select "Run with Powershell", it always comes up with an error saying "Unspecified error". It does it with any Powershell script. That always worked fine in Opus 11, and I can still run the scripts from a Powershell console. I've tried shutting down and restarting Opus, but still get the same result. This is on Win7 Pro.

Is that a command you added yourself, or one added by something else (or part of Windows)?

If you added it yourself, what are the details of what it runs?

If it's not part of your Opus config, does the same thing work on the same file in File Explorer?

Could you post a screenshot of the error dialog so we can see what style of UI it uses? That can help identify if the error is coming from Opus or something else.

One possibility is antivirus is blocking the script being run by the Opus 12 exe while it didn't mind the Opus 11 exe for whatever reason.

The Powershell scripts are ones I wrote myself. Mostly they just copy ZIP files to other locations, using Copy-Item. I have a number of such scripts for backing up stuff I change regularly. But I've also tried other scripts that do completely different things (that I also wrote), and they all give the same error.

image

When I try in Explorer, there's no Run with Powershell option in the right-click menu at all (I think there used to be, and is on other PCs I use). I also noticed that the "Edit with Notepad++" option that used to be in the right-click menu is not there now either, so I had to add it under the "Open With" list (by searching for the executable). It's still on the Explorer right-click menu though.

So something seems to have affected the right-click menu. Run with Powershell is there in Opus, but not in Explorer, but doesn't work in Opus. Other things that have been added to the menu are still there (though I'm not sure if it's all of them) and still work (eg. 7-zip, open in other editors, Move to OneDrive, etc.).

ETA: I've just updated Notepad++ to the latest version, and that's put it back into the Opus right-click menu.

After Googling, I found the solution. It seems the problem is when I added Notepad++ to the Open With menu, which must have made it the default. By setting the default program for .ps1 files back to Notepad, the Run with Powershell option came back in Explorer and now works again in Opus.

1 Like