如何使用.NET运行.cmd? [英] How to run .cmd using .NET ?

查看:68
本文介绍了如何使用.NET运行.cmd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件名:



runlitecoin.cmd

该文件包含:

minerd -a scrypt -o stratum + tcp://europe.mine-litecoin.com -O raekki.worker1:x





是有没有办法用VB.NET代码调用这个命令?



这里(minerd)是一个应用程序minerd.exe。



当我直接打开Litecoin.cmd

然后它工作

但是当我使用代码并试图打开Litecoin.cmd它不起作用



我试过:

1.Process.Start(Litecoin.cmd)结果=不工作

2.System.Diagonostics.Process.Start(Litecoin.Cmd)结果=不工作

3. Process.Start(C:\\minerd.exe, - a scrypt -o stratum + tcp://europe.mine-litecoin.com -O raekki.worker1:x)

不起作用.....



并且也不能用.bat扩展文件!



有没有办法做到这一点?我的意思是我要找的东西?



谢谢高级。

I have a file name :

runlitecoin.cmd
On that File Contains :
minerd -a scrypt -o stratum+tcp://europe.mine-litecoin.com -O raekki.worker1:x


is there any way to call this command using VB.NET code ?

here (minerd) is a application "minerd.exe".

When I Directly Open Litecoin.cmd
then it Works
But when i use code and tried to open Litecoin.cmd it doesnt work

I tried :
1.Process.Start("Litecoin.cmd") Result = Not Working
2.System.Diagonostics.Process.Start("Litecoin.Cmd") Result = Not Working
3. Process.Start("C:\\minerd.exe", "-a scrypt -o stratum+tcp://europe.mine-litecoin.com -O raekki.worker1:x")
Not Works Too.....

and not works also .bat extension files !

Is there any way to do that ? I means what i am looking for ?

Thanks In Advanced.

推荐答案

我刚试过一个简单的.CMD文件。

DIRIT.CMD:

I just tried it with a simple .CMD file.
DIRIT.CMD:
dir d:\Temp>d:\aList.txt



和非常简单的代码:


and very simple code:

Process.Start(@"D:\Temp\dirit.cmd");

确定

文件已创建且工作正常。



所以...我的猜测是:你需要路径你想要运行的文件,因为它不在与您运行它的应用程序相同的文件夹...

And sure enough
the file is created and it works fine.

So...my guess is: you need to path the file you are trying to run, because it isn't in the same folder as the application you are running it from...


这篇关于如何使用.NET运行.cmd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆