简体   繁体   中英

Using “Visual Studio code” with interactive Powershell window like Powershell ISE

I'm new to Visual Studio code so thanks in advance for the help.

I often use the PowerShell ISE with an interactive PowerShell window. I open it, type a few commands, then run a script (such as opening a PowerShell session with Office 365) and then type a few more commands.

Is there any way to do the same thing with Visual Studio code? I see a way to run scripts and debug them but not have them complete but the PowerShell window still stay around so I can continue working.

Decided to convert to answer, since this is a bit too much for comments:

Go to settings > user settings and change "terminal.integrated.shell.windows" to:

"C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",

Ctrl + Shift + ` opens the terminal. Using the + button on the terminal window you can launch additional powershell instances.

Also there's an extension that allows for launching several different terminals under the same VSCode process (cmd,powershell,bash,etc). Minor nuance, shells are being started with the same permissions VSCode has, but you can re-elevate once inside the shell.

References:
https://code.visualstudio.com/docs/editor/integrated-terminal https://code.visualstudio.com/docs/customization/userandworkspace
https://github.com/Microsoft/vscode/issues/10893

Edit: but I would say its not really convenient, terminal takes away too much space on the screen (well, unless you have like 2k or 4k display), so I use powershell + vscode.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM