如何从命令提示符下触发Visual Studio宏? [英] How to trigger a Visual Studio Macro from the command prompt?
问题描述
我的要求很简单.我要做的就是从Visual Studio复制错误列表并将其粘贴到Excel工作表中.但我想在命令提示符下执行此操作.假设我有一个Visual Studio宏来复制错误列表.现在,如何在命令提示符下触发该宏并将其粘贴到Excel工作表中?
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?
或者,是否可以编写宏以复制整个错误列表并将其粘贴到Visual Studio宏中的excel中?然后从命令提示符处触发该宏.
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.
推荐答案
您可以使用以下PowerShell脚本在运行的Visual Studio实例中执行命令:
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")
这篇关于如何从命令提示符下触发Visual Studio宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!