Console Application (Non) Support in the ISE

PowerShell Team

There are some limitations on how the ISE interacts with console applications you need to be aware of, for apps like ftp and netsh.

First of all, the ISE Runs console apps that don’t require user input just fine.
For example, “ping www.microsoft.com” and “cmd /c dir /s”

Piping also works fine in the ISE,
For example, PS C:\Users\ibrar> “show mode” | netsh
netsh>online

Automation in scripts, that don’t require user interventions should be fine.

However, if you run “cmd /k” which requires input, the ISE will be stuck, and you’ll have to stop the pipeline, using Ctrl-Break or pressing the stop button.

It can get annoying, and it’s slightly less annoying to get an error. If you run cmd, or netsh, you get,

Cannot start “cmd “. Interactive console applications are not supported.
To run the application, use the Start-Process cmdlet or use “Start PowerShell.exe” from the File menu.
To view/modify the list of blocked console applications, use $psUnsupportedConsoleApplications, or consult online help.
At line:0 char:0

You can call $psUnsupportedConsoleApplications.Add to add commands accidentally typed into the ISE, like ftp which is not on the list.

The other way to do it, is to be conscious and do “start ftp.exe” (start is an alias to start-process)

This will launch it into a new window, and not block the ISE. Some customers have done things like

function vim { start-process vim $args }

This will ensure that vim will launch with the filenames that you specify, even when ran in the ISE. It’s a very good thing to keep it in your $profile

And if you really need a console, you can always launch PowerShell using Ctrl-Shift-P or press the PowerShell icon in the command pane

Hope this helps,
Ibrahim Abdul Rahim
[MSFT]

0 comments

Discussion is closed.

Feedback usabilla icon