alternative to 'code' visual studio in pycharm - visual-studio

Some of my coworkers use visual studio code. Personally I am already used to pycharm. I've seen my colleagues using code filename in the VSC terminal, so that it opens the file filename in a new VSC tab. Is there a similar alternative in pycharm?

Yes you can create a CLI launcher in the Tools menu "Create Command-line launcher"
The last part of the path is the name you decide to give the launcher e.g "pcharm" or "pyc" (anything of your choice) and save it.
Reload the terminal, and run the command with your file name.

Related

How to open file in a specific application from the command line

I want to open a .md file in a repo in visual studio code from my command line. Does anyone know the command for this?
I am using the bash shell.
First, you need to have Visual Studio Code CLI. ( Try code --version in terminal to check if it's already installed or not ). You have to install it manually on mac OSX (see below). In windows and linux, the command line interface code should be readily available in the PATH.
To install it (in MAC)
Launch VS Code.
Open the Command Palette (⇧⌘P) and type ‘shell
command’ to find the Shell Command: Install ‘code’ command in PATH
command.
After that you can use:
code filename
to open the filename in Visual Studio.
For more information, click
code --help will give you more information.
For example, code -r filename will open the file in already opened Visual Studio window.

How to add batch file in windows environment variable

I am following the installation guide for openvino on Windows. After a successful installation, we need to run setupvars.bat file in order to initialize the openvino environment. We can also add it permanently in environment variable so that it is initialized automatically. But the instructions are not given on how to add it.
I wanted to know if its possible to add the setupvars.bat so the it runs automatically. Also I need to run the visual studio from the same environment.
I always do this step manually which takes a lot time. I first open a cmd, navigate to the desired folder and then run setupvars.bat. After that from the same cmd, I navigate to the visual studio installed directory and then start the visual studio from the cmd so that visual studio is launched under same openvino environment. Is is possible to automate all this task. Thanks
Solution 1: You can set the environment variables for the visual studio as mentioned here - How do I set specific environment variables when debugging in Visual Studio?
Solution 2: Write one more batch file which will 1st call setupvars.bat & then open the visual studio. Then you can run the new bat file.
Solution 3: You can create a cmd shortcut like this - Run a Command Prompt command from Desktop Shortcut
In this, you can 1st call setupvars.bat and then cmd to open Visual Studio. Once you click the new shortcut both the things should happen automatically. You can even add this step along with the installer.

Command Prompt in Visual Studio

I want to add a command prompt that opens in project folder when I right click my project to open a context menu -- see below:
I know how to create a command prompt link through Tools > External Tools but I don't know how to add that link to my context menu.
Could someone tell me how I can do this? Thanks.
P.S. I'm currently using the latest version of Visual Studio 2017 i.e. 15.4.5
You can use the Open Command Line extension to open a command prompt on the project's path.

Env vars for Visual Studio command prompt

I'm doing an RDP into a machine that has just the CLR installed, and doesn't have Visual Studio on it. Can I somehow load all the Visual Studio-specific environment variables on to the regular command prompt and convert it into the VS command prompt so that I'm able to build my projects via command line?
I looked at the vcvarsall.bat file. That calls the appropriate processor-specific batch file. Couldn't get any inputs from there.
Short of installing all VS, or tracing thru all the various batch files to find out what's getting set, you may be able to simply capture the env vars that are set.
Open up a VS command prompt, and run set > vars.bat
Then open up vars.bat, and put a set command in front of each line.
Not sure how much this will help, since you're going to be missing all the utilities that come with Visual Studio, but it does answer your question.
I don't recommend trying to copy only what you need. You'll need other header files, libraries, dlls, etc... You can instead install VS express edition.
If you are trying to debug a problem you can use remote debugging in Visual Studio or use WinDbg on the computer.

How to embed command shell in Visual Studio

I would like to be able to embed a command line interpreter inside a dockable window in Visual Studio. Is there any nice way to do this?
See the VS Command shell project
Checkout Open Command Line by Mads Kristensen. note it doesn't really "embed" the shell in VS, rather it adds a keyboard shortcut to open the shell at the project directory
it supports bash, powershell, git bash, ...etc
In Visual Studio click Tools -> NuGet Package Manager -> Package Manager Console
It embeds a cmd prompt with everything on your %PATH% you'd expect.

Resources