Tired of manually opening Visual Studio projects? This guide will help you set up a 'vs .' command, just like 'code .' for VS Code, to quickly open your Visual Studio projects from the command line.
To simplify the setup, pick the pre-made batch file that matches your Visual Studio version:
- Pick vs-2022.bat For Visual Studio 2022
- Pick vs-2019.bat For Visual Studio 2019
- Pick vs-2017.bat For Visual Studio 2017
After picking the right one, move the file to C:\Windows\
so it can be accessed from anywhere.
❗IMPORTANT: Rename "vs-version
.bat" to "vs.bat", otherwise "vs ." wouldn't work but for example "vs-2022 ." will work.
If the command does not work, the path to devenv.exe
in the batch file may not match your Visual Studio installation. To check:
- Open File Explorer and navigate to:
C:\Program Files\Microsoft Visual Studio\<your-version>\Community\Common7\IDE\devenv.exe
- If the path does not exist, check if you installed Professional or Enterprise, and adjust the batch file accordingly.
- You can manually edit the batch file with Notepad to correct the path.
- Open Command Prompt (
cmd.exe
) or PowerShell. - Navigate to a folder with a Visual Studio solution (
.sln
file):cd C:\path\to\your\project
- Run:
vs .
- If a
.sln
file is found, it will open in Visual Studio. - If no
.sln
file is found, Visual Studio will open the folder.
- If a
✔️ Faster project access
✔️ Works exactly like code .
for VS Code
✔️ No need to manually search for .sln
files
- Command not recognized? Restart the terminal or your PC.
- Using a different Visual Studio edition? Adjust the executable path in the
.bat
file. - Multiple
.sln
files in a folder? It will open the first one found. - File path incorrect? Follow step 2 to verify the correct installation path.
Licensed under the ‘Please Don't Sue Me’ License.😆