I'm trying to open a new Powershell ISE window providing my own script .ps1 file.
How can I accomplish that? Seems that the only way to open a new Powershell ISE window is with a blank script file, and not one one's may choose(ie start powershell_ise.exe -file "myfile.ps1"
- That's not working).
Here is a few solutions:
1) Use ISE twice, the only downside is that you'll see extra untitled doc
ise; ise ".\test.ps1"
2) You can start it in admin mode (from non-admin mode), it will force to create a new ISE:
Start-Process powershell_ise -ArgumentList ".\test.ps1" -Verb RunAs
3) Run as different user
Start-Process powershell_ise -ArgumentList "-noprofile .\test.ps1" -Credential $cred
Method 2/3 only open new ISE once though (until you close it)
From inside powershell I run:
ise myfile.ps1
and it will open it.
Simply put, I don't think it's possible. I've done a quick Google and found the answer that campbell.rw posted but the same thing occurred. Similarly, I've just tried to start a new PowerShell ISE process using the following command...
Start-Process -FilePath C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe -ArgumentList "-File .\testscript.ps1"
...but like you mentioned in the comments below the existing answer, instead of opening a new instance of PowerShell ISE it simply creates a new tab in the same instance with the script I specified in the 'ArgumentList' parameter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.