I thought it might be time to start using PowerShell instead of cmd. I currently run Python scripts from Notepad++ with the following commnad:
cmd /c cd &quot;$(CURRENT_DIRECTORY)&quot; &amp;python -i &quot;$(FILE_NAME)&quot;
How should I modify this to get the same behaviour in PowerShell please?
I tried
powershell -noexit cd &quot;$(CURRENT_DIRECTORY)&quot; &amp;python -i &quot;$(FILE_NAME)&quot;
but I got an error about ampersands. I know very little about PowerShell or cmd in general - I just use them to run my Python scripts.
After a bit more digging I found a solution:
powershell -noexit cd '$(CURRENT_DIRECTORY)'; python -i '$(FILE_NAME)'
PowerShell seems to prefer single quotes for paths so I wrapped $(CURRENT_DIRECTORY) and $(FILE_NAME) in single quotes.
Also, & is replaced by ; for multiple commands.
If there is a more "correct" way of doing this, please let me know.
Calling PowerShell from Python using Notepad++