How to use native windows commands in VsCode`? - cmd

I have installed a command prompt shell in Visual Code and I have a compiler that I usually run from the windows cmd. I'm wondering how can I make the windows commands (and my own) that works in cmd run in the Visual Code Command prompt?

Related

why command are not recognized by the command prompt?

I have tried several times to type the command 'ls' at the command prompt of Windows 10 but it shows me that the command is not recognized as an internal or external command, an executable program or a batch file.
The "is" command is for Linux, not for Windows, and like Kraigolas said, the Windows OS command is "dir". Hope this helped.
The ls command is for linux and it's equivalent for windows command prompt is dir. But if you are more of a linux user then you can try using power-shell on windows where ls command works just like the way it works in linux. Power-shell is like a hybrid between windows command prompt and linux terminal.

Use Windows Terminal in place of cmd when a command line exe is executed

I have a couple command line apps (launch4j + java.exe) I use.
I'd like to run them on Windows Terminal instead of cmd.exe. But, even after installing Windows Terminal, when I execute the launch4j exe, it still runs on cmd.exe.
If I run wt myapp.exe -oneinput it works, but I'd like to run myapp.exe directly.
Is there any setting I must do so that Windows Terminal is used in place of cmd.exe?
The Windows Terminal team are working to enable Windows Terminal to become the default command-line user experience on Windows.
Stay tuned to the Windows CommandLine Blog for news and updates on up-coming features.

Running the Linux Subsystem from Visual Studio's Post-Build Command Line

I am trying to run the Windows 10 Linux Subsystem from Visual Studio 2015's Post-Build Command Line. That is, I have a command, whose output will be piped to bash, for example xyz | bash. bash should in turn start the Windows 10 Linux Subsystem and execute the command.
This works perfectly when running the command from the regular CMD.exe Command Line or .bat files. However, when running this from the Visual Studio 2015 Post-, Pre-Build- or Pre-Link-Event Command Line directly, via a call cmd /C call or an external .bat file as proxy, this fails with error code 255 and prints something like "Command 'bash' not found.". When trying to use the complete path to the bash.exe this fails, too.
How can I run bash from Visual Studio's Command Line?
Sidenote: I am trying to run this on a C/C++ Project.
I faced this problem too when using bash from my 32-bit C++ application.
The thing is that bash is 64-bit only – when you try to use it from a 32-bit app, your call to C:\Windows\System32\bash.exe gets redirected to C:\Windows\SysWOW64\bash.exe which does not exist.
To bypass the redirect you have to use C:\Windows\Sysnative\bash.exe when calling bash from a 32-bit app. I actually made a batch (.bat) proxy that I added to the PATH to make things easier. 🙂
bash.bat:
#echo off
if exist "C:\Windows\Sysnative\bash.exe" (
C:\Windows\Sysnative\bash.exe %*
) else (
C:\Windows\System32\bash.exe %*
)

Configuring cl CMD compiling Windows

I have already read on MSDN.com that to enable command line compilation through the cl command you have to run the vcvarsall.bat file. I have run this file in CMD and compiled code using the cl command. The issue is that after I leave the CMD and reopen it, I no longer have the ability to use cl and have to rerun vcvarsall.bat every time I reopen CMD. Is there any way to avoid having to do this? Thanks.
Just create a shortcut on your desktop that calls
cmd /k "%VS140COMNTOOLS%\vsvars32.bat"
Adapt the environment variable and batch file name to fit your installed VS version number. In the example above, this will work with Visual Studio 2015.

Command line does not execute my parameters

I have created a batch file to run an application automatically but it seems my CMD does not run it. I typed this (using notepad as an example):
CMD /C "C:\notepad2\notepad2.exe"
If I run this from Windows Vista it worked. But running this from Windows Server 2008 (64-bit) it just doesn't work. I even try using that line from the Run menu but no go.
What do I do? My aim is to run a scheduled task that runs the batch file every now and then.
Stupid question, but does the program you're trying to run actually exist on the Server 2k8 machine?
There are no differences in cmd between Vista and Server 2k8 whatsoever.
Besides, why do you need to execute it via cmd? Can't you just run the application directly? Using cmd /c is only necessary for shell built-ins, such as dir or start.
Also remember that there is no NTVDM on 64-bit Windows—you can't run 16-bit programs. I doubt one would still use them nowadays but it may be the only thing I can think of why it doesn't work in 64-bit.

Resources