在远程服务器上执行.bat文件 [英] execute .bat file on remote server
问题描述
如何在远程服务器上运行.bat文件.我已经粘贴了我的代码,但是无法正常工作.它导致以下错误:
登录失败:未在此计算机上向用户授予请求的登录类型
AppPath = @" \\ da9741s033 \ d $ \ EmailServices \ AdhocProdRun \ bin \" ; 字符串 strFilePath = AppPath + "ACH-DDS_Dashboard_MNTLY.bat" ;
System.Diagnostics.
处理 proc = 新 System.Diagnostics. ();字符串 pwd = 欢迎" ; "amrs" ; "kemani" ; SecureString secret = 新 System.Security. ();
foreach ( c in pwd)
secret.AppendChar(c);
proc.StartInfo.Password =秘密;
proc.StartInfo.UseShellExecute =
false ;proc.StartInfo.WorkingDirectory =
@" ;同时 (!proc.HasExited)
{
proc.Refresh();
}
proc.Close();
有人可以帮助我吗?
谢谢
你好Kesavaraj
请查看此代码项目,然后也下载该项目.希望对您有帮助.
http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx >
谢谢
How can i run the .bat file on remote server. i have pasted my code but its not working. Its ginving the following error:
Logon failure: the user has not been granted the requested logon type at this computer
string AppPath = @"\\da9741s033\d$\EmailServices\AdhocProdRun\bin\";
string strFilePath = AppPath + "ACH-DDS_Dashboard_MNTLY.bat";
System.Diagnostics.
Process proc = new System.Diagnostics.Process();proc.StartInfo.FileName = strFilePath;
string pwd = "Welcome";
proc.StartInfo.Domain =
"amrs";proc.StartInfo.UserName =
"kemani";System.Security.
SecureString secret = new System.Security.SecureString();foreach (char c in pwd)
secret.AppendChar(c);
proc.StartInfo.Password = secret;
proc.StartInfo.UseShellExecute =
false;proc.StartInfo.WorkingDirectory =
@"\\da9741s033\d$\EmailServices\AdhocProdRun\bin\";proc.Start();
while (!proc.HasExited)
{
proc.Refresh();
}
proc.Close();
can anyone help me?
Thanks,
kesav
Hello Kesavaraj
Please review this code project and download that project also. I hope it will help you.
http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx
Thanks
这篇关于在远程服务器上执行.bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!