开发者

Executing a console application from the command line?

开发者 https://www.devze.com 2023-02-15 14:35 出处:网络
I need to make a basic console application, which will simply upload some documents to my CMS-driven site. However, this will be executed from an automated build. Ideally, it\'d be good to execute the

I need to make a basic console application, which will simply upload some documents to my CMS-driven site. However, this will be executed from an automated build. Ideally, it'd be good to execute the 开发者_如何学Cconsole app from the command line. Is this possible?

Thanks


Console applications are executable assemblies. If your automated build process can execute shell commands, then it can launch the console application. If the application needs input, then command line redirects can be used

Suppose the command takes a list of files, with a newline (basically the enter key) pressed after inputing each file name. You can then make inputfile.txt like so:

filename1
filename2
filename3

Then, run the command like so:

command.exe < inputfile.txt

For your automated build process, I am currently assuming you are using Visual Studio. So, edit your project properties and add the command in either the pre-build or post-build event command line, depending on where you need the functionality.

0

精彩评论

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

关注公众号