0

I've got some .py and etc. file with code.

How to open it in powershell as text? I mean using invoke-item allows to open .txt in notepad but code.py will be executed using python.

So how to open it using powershell but in notepad at least(in notepad++ preferably)

1
  • 2
    you can open a file in notepad with notepad.exe your_file.py. If notepad++ is on your PATH then you should be able to do something very similar to open it with that application. Commented Feb 4, 2014 at 22:47

2 Answers 2

2

Invoke-Item will open the application that has the file association for that file extension.

You could try Start-Process. I assume .py files will behave the same as .cs files but

Invoke-Item a.cs opens visual studio

Start-Process notepad a.cs opens notepad

But then again

notepad a.cs opens notepad as well.

If you're really keen to use Invoke-Item it appears its possible to update file associations using PowerShell - change-file-asociations-via-powershell

Sign up to request clarification or add additional context in comments.

Comments

0

As already said just use: notepad yourcode.py

As for notepad++, perhaps the best ways to do it are stated here: How to execute a PowerShell script from Notepad++

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.