Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel

Sample Settings for Text Editor

Visual Studio 2013

  •  Text Editor C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
  • GoTo Line Command Line /edit '%path%' /command 'edit.goto %pos%'

Visual Studio 2017

  •  Text Editor C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe
  • GoTo Line Command Line /edit '%path%' /command 'edit.goto %pos%'


Launch Visual Studio Using VBScript
 

Expand
Code Block
languagevb
titleVBScript Code to Start/Activate Visual Studio with a File@Line
filepath = WScript.Arguments(0)
if Wscript.Arguments.Count=2 then
   line = WScript.Arguments(1)
else
   line = 1
end if

On Error Resume Next

' try to get running instance
Set dte = getObject(,"VisualStudio.DTE.15.0") ' VS2017 (from registry depending on installed version)
If Err.Number <> 0 Then
   Err.Clear
   ' try to get new instance
   Set dte = WScript.CreateObject("VisualStudio.DTE")
End If

If Err.Number = 0 Then
   ' activate instance
   dte.MainWindow.Activate
   dte.MainWindow.Visible = True
   dte.UserControl = True

   ' load file
   dte.ItemOperations.OpenFile filepath
   ' try to to line
   dte.ActiveDocument.Selection.MoveToLineAndOffset line, 1
   
   ' formulate title bar
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Set objFile = objFSO.GetFile(filepath)
   filename = objFSO.GetFileName(filepath)
   appTitle = filename & " - Microsoft Visual Studio"
   
   ' bring to instance front
   Set ObjShell = CreateObject("Wscript.Shell")
   ObjShell.AppActivate(appTitle)
Else
   msgBox "Unable to start VS for " & vbcrlf & filepath & vbcrlf & appTitle
End If

 

NotePad++

  • Text Editor C:\Program Files (x86)\Notepad++\notepad++.exe
  • GoTo Line Command Line -n%pos% '%path%'

Visual Studio Code

  • Text Editor C:\Program Files (x86)\Microsoft VS Code\Code.exe
  • GoTo Line Command Line -g '%path%':%pos%:1

...