0

My requirement is quite simple. All I wish to do is copy the error list from Visual Studio and paste it in an excel sheet. But I want to do it from the command prompt. Let's assume that I have a Visual Studio macro that copies the error list. Now, how do I trigger that macro from the command prompt and paste it into the excel sheet?

or, is it possible to write a macro to copy the entire error list and paste it into an excel in visual studio macros? and further, trigger that macro from the command prompt.

1 Answers1

1

You can execute a command in a running Visual Studio instance with the following PowerShell script:

$dte = [runtime.interopservices.marshal]::GetActiveObject("visualstudio.dte")
$dte.ExecuteCommand("Help.About")
Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66
  • how can I get the running visual studio instance through command line? – Vidhathri Avadhany Mar 30 '21 at 05:44
  • @VidhathriAvadhany Can you please clarify what you mean by "command line"? – Sergey Vlasov Mar 31 '21 at 07:40
  • The Command Line Interface. I am actually trying to write a windows batch file which will call the macro(that copies the error list for a particular project) and then paste it into an excel sheet. That is why I am trying to call the Visual Studio Command from the CLI. – Vidhathri Avadhany Mar 31 '21 at 12:42
  • @VidhathriAvadhany You can execute a PowerShell script from a windows batch file like this: powershell.exe .\1.ps1 – Sergey Vlasov Apr 01 '21 at 03:54