开发者

Visual Studio 2010: use command line in a macro and write the output from the cmd to the output pane

开发者 https://www.devze.com 2023-04-02 08:47 出处:网络
I\'m using a macro in Visual Studio 2010 to do some stuff with a .bat. The .bat generate some output text in the Command Line Console.

I'm using a macro in Visual Studio 2010 to do some stuff with a .bat. The .bat generate some output text in the Command Line Console. Is it possible to get the output text, to display it in the output pane?

Here is a part of my code:

Sub CompileSCSS()

    Dim cmd As String

    cmd = String.Format("{0} watch {1} ", "C:\Ruby192\bin\Compass.bat", "C:\Workspace\MyProject\Solution\WebApp")
    Shell(cmd, AppWinStyle.NormalNoFocus, False)

    Write("Debug", "I want to write here the output of my .bat")

End Sub
开发者_JS百科

Just for the context, and to help you to understand my needs:

My .bat is using a third party tool to compile my SCSS (an extention of the CSS syntax) and generate the corresponding CSS in a file. When the compilator has finished working, it give an output if everything's is good or if there is some errors. I would like to integrate the message information directly into the output pane, and then automatise the compilation of my SCSS file (on a Ctrl+S for exemple), so I can check almost immediately the results on the browser.

Sorry for my english, you can correct me if needed :-)


Just define your .BAT as an external tool. It has an option to show the output in the output window. You can then assign a keyboard shortcut for it. If you still need to call it from a macro, use syntax:

DTE.ExecuteCommand("Tools.ExternalCommandX")

where X is an order number of your external tool.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号