I hope this is an easy fix, but I couldn't find any documentation or other posts on the matter. I'm trying to write a script (cmd
or pwsh
) that will launch vscode with my preferences on a portable install.
When trying to execute vscode's code.exe
with any arguments, it ignores them and just launches the program as if I had typed nothing else. I'm following this doc in my testing. Using alias switches doesn't work, either. The only argument that does seem to process is if I include a path.
code.exe --help
code.exe --version
Additionally, after launching code.exe
, the console kind of hangs, then vscode status messages are sent to that console (even without use of the --wait
switch). If I close the console, vscode shuts down. Is there a way to work around this?
For example, entering C:\abc.exe /W /F on a command line would run a program called abc.exe and pass two command line arguments to it: /W and /F.
The java executable passes an empty array of type String to the main method if no command line arguments are passed.
It is possible to pass some values from the command line to your C programs when they are executed. These values are called command line arguments and many times they are important for your program especially when you want to control your program from outside instead of hard coding those values inside the code.
To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.
When using Code via shell (cmd
or pwsh
), it does not use Code.exe
, but the script/batch files located under Bin
folder (code.cmd
). These are the applications which really recognizes the command line switches.
This is not entirely clear in the Command Line Documentation page, but looking closer at the Note you will see that it does say the Program Files\Microsoft VS Code\bin
folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With