2

Is there a way to open a script file ($profile or otherwise) from within the IDE's command environment (PS> prompt), such that it loads in the IDE itself?

# loads the current user/current host profile in Notepad (probably because .PS1 is associated w/ Notepad.exe)
PS > ii $profile

# same for any random script file
PS > ii .\Foo.ps1
1
  • I changed the "open with" property of my .ps1 files to powershell ise. Then "ii $profile" will open my profile in ise. Commented Jun 3, 2015 at 20:31

1 Answer 1

3

Instead of Invoke-Item, just use ise. When run from the ISE, it will load the file.

PS> ise myscript.ps1

To make Invoke-Item behave like you want (as well as double-clicking from Explorer), you can associate .ps1 files with powershell_ise.exe. Here is a blog post explaining how to do this if you need it.

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

2 Comments

In the interim (awaiting an answer), I decided to make an alias to the IDE using that very alias, only discover that it already existed.
The ise command seems to choose a ISE at random if multiple ISEs are open. You would think that it would select the ISE from which the command is executed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.