-
Powershell ISE (probably you have it already in your Windows, if you want to use it. If not, search for instructions)
-
Notepad++ (duh!)
-
nppExec plugin (always worth having! You can install it via N++'s plugin manager or download it from GitHub repository))
-
Backup
%APPDATA%\Notepad++\tabContextMenu.xmlfile -
Open NppExec console (
F6by default). Pase following code:NPP_CONSOLE 0 cd $(CURRENT_DIRECTORY) npp_run $(SYS.WINDIR)\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe -
Click on the
Save...button and give it some name (e.g.powershellrun) -
Go to plugins advanced options (
Plugins->NppExec->Advanced options) -
Follow the screenshot instructions
-
Choose
powershellrunfrom the list -
Set name
powershell -
Click on the
Add/modify -
Optionally (I recommend it!) set commands to appear in the
Macromenu -
Save changes with
OK
-
-
Open Notepad++ tab menu file (
%APPDATA%\Notepad++\tabContextMenu.xml) -
Add the following line:
<Item PluginEntryName="NppExec" PluginCommandItemName="powershell" ItemNameAs="Open in PowerShell"/>(PENmust be like that,PCINis the name from image 2nd point,INAis how it will look in the tab context menu) in the place where you find it most useful (of course in the<TabContextMenu>root) -
Restart Notepad++ and enjoy!
If something went wrong, check:
- If the script runs (F6, choose saved script, click OK - it should open PS ISS in the directory of currently open file)
- If it won't run, try changing the first line to
NPP_CONSOLE 1. Run the script, observe if there are errors - Try to run manually (
win+R)%WINDIR%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe. If it says the file is missing, use correct path in the script - If script runs, but menu item doesn't appear check again if the name from ii (picture 2.) point is the same as
PluginCommandItemNamein the XML. - Try adding
ItemNameAs="foobar"to some existing menu item. Restart Notepad++. If you don't see "foobar" in list, it means Notepad++ loads default, hardcoded values, as it can't parse the XML file, so you probably deleted something important or pasted the line in the wrong place. Restore the backup (from the point 1), try adding it, this time without destroying structure.
If it still don't work, feel free to contact me. If you find it too difficult, I can record in OBS a whole process for you.