文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C#执行Shell命令,WebService需要访问其他服务器的文件时,在IIS中登入Windows用户

C#执行Shell命令,WebService需要访问其他服务器的文件时,在IIS中登入Windows用户

时间:2010-11-09  来源:Jeff Chow

 

通过Shell命令可以登入Windows用户,不过C#对于Shell的支持不像VB,需要通过Process来实现。

 

Process p = new Process();
p.StartInfo.FileName = @"net";
p.StartInfo.Arguments = @"use \\<server name|server ip>\<folder name> <password> /user:<username>";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
p.Close();
相关阅读 更多 +
排行榜 更多 +
吹风机射击 v1.0 安卓版

吹风机射击 v1.0 安卓版

飞行射击 下载
吹风机射击 v1.0 安卓版

吹风机射击 v1.0 安卓版

飞行射击 下载
吹风机射击 v1.0 安卓版

吹风机射击 v1.0 安卓版

飞行射击 下载