Skip to content

Easily open Visual Studio from the command line with a simple 'vs .' command, just like 'code .'. This guide helps you set up a shortcut to open your projects faster.

Notifications You must be signed in to change notification settings

Florianvhunnik/OpenVisualStudioShortcut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Visual Studio with 'vs .'

🚀 Overview

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.

🎬 Demo

VS Shortcut in Action

🔧 Setup Instructions

1. Clone or download this repository

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.

2. Verify the File Path (Important!)

If the command does not work, the path to devenv.exe in the batch file may not match your Visual Studio installation. To check:

  1. Open File Explorer and navigate to:
    C:\Program Files\Microsoft Visual Studio\<your-version>\Community\Common7\IDE\devenv.exe
    
  2. If the path does not exist, check if you installed Professional or Enterprise, and adjust the batch file accordingly.
  3. You can manually edit the batch file with Notepad to correct the path.

3. Test the Command

  1. Open Command Prompt (cmd.exe) or PowerShell.
  2. Navigate to a folder with a Visual Studio solution (.sln file):
    cd C:\path\to\your\project
  3. 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.

🎯 Benefits

✔️ Faster project access
✔️ Works exactly like code . for VS Code
✔️ No need to manually search for .sln files

🛠️ Troubleshooting

  • 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.

📌 License

Licensed under the ‘Please Don't Sue Me’ License.😆

About

Easily open Visual Studio from the command line with a simple 'vs .' command, just like 'code .'. This guide helps you set up a shortcut to open your projects faster.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published