Can I launch az login with cmd rather than PowerShell in Visual Studio Code? - azure

What's the problem I'm having?
I get the following error when running 'az login' from the terminal in Visual Studio code:
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe: Invalid
argument
What's the environment?
I'm running Visual Studio code in Windows 10 (version 1809, OS build 17763. 1158). I'm using Ubuntu 18.04 with WSL 1 and I've set my terminal to use "C:\Windows\System32\bash.exe"
I seem to have problems with PowerShell launching from VS code. Does anyone know if it's possible to configure VS code to use cmd rather than PowerShell when doing an az login? Any other suggestions are welcome. Thanks.

For the Visual Code, you can set the default shell as cmd if you want to use the cmd when you need the terminal. It looks like this:
1.
2.
When you finish these two actions, then you can get the cmd terminal when you want a new one. In this way, the cmd is the default.

Related

I don't know how delete python2 in mac?

I used visual studio in mac air and I install python3.8.5 but already mac has python2
So I can't use python3.8 in visual studio..
I don't know how delete python2 in mac?
plz give me some tips..
You can change the default shell in use selection a new one, you can choose default shell in execution when using visual studio code:
You can customize your shell execution selecting the Select default shell, after you can select your current path to python3.
To discover where is your default python3 installation you can run the command:
which python3
#/usr/local/bin/python3
After that you can configure the default python3 path in your visual studio instance.
just select the terminal and override the terminal.integrated.shell.osx: environment variable.

How to run a command in Developer command prompt 2019 using Python

I'm trying to do build in Developer Command Prompt of VS 2019 using Python script.
Here is piece of code i'm using:
import os
os.system('start /wait C:/Windows/System32/cmd.exe "msbuild C:/Users/Desktop/Project/Project.sln"')
os.system("pause")
But it is not working.Developer command prompt is appearing for just 1sec and disappearing .
When i took variable to check if command was succesful or not ,it is giving variable result as zero,which means command is successful but i'm not able to see it in Developer command prompt.
result= os.system('start /wait C:/Windows/System32/cmd.exe /k ipconfig')
print (result)
Whereas when i'm trying the same command in windows command prompt it's working fine.
How to run a command in Developer command prompt 2019 using Python
Developer command prompt 2019 is a tool which is integrated into VS2019 IDE and provides environment parameters for various development modules.
However, the CMD.exe does not have these environment variables for these, so you cannot just use CMD.exe directly. Sorry that I am not familiar with python code and script. I suggest you could configure Developer command prompt 2019 into System environment variable PATHand then call cmd.exe which integrates the related variables to build your projects without any errors.
Suggestion
First, if you build your project on another new agent, you should install one of tool from step 1.
1) If you install VS2019 IDE in your local agent,please make sure that your local agent has VS2019 IDE and install the related workload about your project type.
Besides, if you install Build Tool for VS2019, please also install the related workload.
2) set the below path under System environment variable PATH
VS2019 IDE:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
Build Tool for VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
3) Then you can call your python script as you described to build your projects.
Any feedback and concern will be expected.

Visual Studio code run as administrator won't run code

Hoping you can help me out here. When running VS code as administrator, VS code won't let me run any code in the terminal at all. Even the simplest code does not work.
When run normally, i have no trouble whatsoever, except for when i use functions which requires administrative privileges. This is where the issue arises.
This is the message i get when trying to run my python scripts in VS Studio code in administrator mode.
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Hope you guys can help me out, it's annoying.
VS Studio code: Newest Version.
OS: Win 8.1
Python: 3.7.1

VSCode with WSL - How to use Bash for the launch configurations?

I use Visual Studio Code to develop a TypeScript Node application on Windows 10, with WSL enabled.
Thanks to other threads, I'm almost able to run a VSCode task with Bash on Ubuntu on Windows.
But now I try to do the same with a launch configuration. How can I make a launch configuration to use the node executable installed in WSL instead of the one installed on Windows?
If I run this command directly in the integrated terminal, with Bash, it works :
node src/start.js
But when I press "[F5]" and start a launch configuration that runs this same file, I get an error : "Error: %1 is not a valid Win32 application". This is because the oracledb library is used and has been compiled in Bash, not in Windows.
How can I make a launch configuration use Bash to run Node?
UPDATE : I opened an issue about that on VSCode's GitHub page.
Not if sure you still need help.
open bash outside of the vs code.
then run the following command, to install node.
sudo apt install nodejs-legacy
and you should be able to run node with bash in vs code.

Why do node tasks spawn new console when run from PowerShell?

On Windows 10, when I run Node.js commands (e.g. node -v) from a PowerShell console, they always spawn a new Windows Command console. When I run the same commands from a Windows Command prompt, they run in that same console session. Interestingly, whatever this is appears to cause the same behavior when running Node commands via the Task runner in Visual Studio Code and when Visual Studio 2017 build steps contain Node commands - each Node command run spawns a new console. This only started about a week or so ago. I don't recall any updates to my PC that could be related. Other developers on my team that use the same tools don't experience this same behavior. I have another PC that this doesn't occur on. What could be causing this?
Windows 10
Node.js v7.8

Resources