使用C#.NET在远程计算机中运行批处理文件 [英] Run batch file in remote computer using C#.NET

查看:110
本文介绍了使用C#.NET在远程计算机中运行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的要求-

我想使用C#.Net在远程计算机中运行两个.bat文件.这两个.bat文件位于远程计算机上.就像-
1. C:\ aa \ aa.bat和
2. D:\ bb \ bb.bat
成功运行aa.bat文件后,将启动bb.bat文件并在成功运行后获取消息.

有人可以给我提供代码吗?这非常紧急.

Below is my requirment-

I want to run two .bat file in remote machine using C#.Net. This two .bat file residing at remote machine.Like-
1. C:\aa\aa.bat and
2. D:\bb\bb.bat
After successfull run of aa.bat file, bb.bat file will be started and getting message after successful run.

Can someone please provide me the code? It''s very urgent.

推荐答案

如果您可以访问远程计算机,并且可以访问并执行文件,则可以使用 Process.Start [
If you have access to the remote machine, and can reach and execute the files, then you can do it with Process.Start[^]

However, it will run the files on your machine, not on the remote machines processor, and at whatever privilege level and access rights your connection is permitted, no more. There are all sorts of things which are designed to prevent your running programs on other machines - firewalls for one.


这篇关于使用C#.NET在远程计算机中运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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