I am trying to get a run command set up in Notepad++ that will run the python file I have open in NP++ with the current_directory set to the folder containing the open script. It is not working, and I have hit a point where I can't figure out why.

I can get the run command to open CMD and change the directory appropriately with the following:


This works as I expect, CMD open in the current directory, waiting for a command. I can type python in here and python starts in this cmd window!

I expect the following run command to do what the previous one did, then run python in the CMD window:

cmd /K cd "$(CURRENT_DIRECTORY)" python

But this does not work, it gives the error:

The system cannot find the path specified.

Does anyone know why this would be happening / what I must do instead to get python to run here?

  • 2
    cd "$(CURRENT_DIRECTORY)" python is an invalid command. Try chaining them cd "$(CURRENT_DIRECTORY)" & python – DavidPostill Jul 3 '19 at 17:52
  • You are my new favourite human! – Hoog Jul 3 '19 at 18:29
  • I wrote an answer (so it can be accepted) as comments are ephemeral. – DavidPostill Jul 3 '19 at 20:24

Does anyone know why this would be happening / what I must do instead?

cmd /K cd "$(CURRENT_DIRECTORY)" python

The above is an invalid command.

You should instead run the two commands sequentially using the & operator

cmd /K cd "$(CURRENT_DIRECTORY)" & python

commandA & commandB

Run commandA and then run commandB

Source Command Redirection, Pipes - Windows CMD - SS64.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.