VS2019 Open file and goto line

Hartmut 1 Reputation point

Hi everyone. I want to open a file in an open instance and then goto line.

I use the command : devenv /edit filename /command "gotoln line"

Unfortunately that doesn't work. It looks like that the goto command is not running.

Strangely, if no instance is open yet, that works. Is there a way to get this to work even when a instance is open.

I use VS2019.



Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,403 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 23,136 Reputation points Microsoft Vendor

    Hi @Hartmut ,

    Welcome to Microsoft Q&A!

    I tested it on my side. I suppose it is designed like this.

    As this document described:

    /Command: Starts the IDE and executes the specified command.
    /Edit: Opens the specified files in a running instance of this application. If there are no running instances, it starts a new instance with a simplified window layout.

    The /edit can be used in the existing instance or no running instance.
    But for /command, every time it will first launch the VS, then executes the specified command.

    If a VS instance has been opened, running “devenv /edit /command” will go to the most recently opened instance. but the /command requires launching a new instance. So it doesn’t work,

    If you have any suggestion about the feature, you can directly report it to product team by selecting “Help” menu > Send Feedback.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments