如果在A机器上调用一个B机器上的EXE文件,在B机器上执行

csdnhw 2006-08-18 01:23:37
如果在A机器上调用一个B机器上的EXE文件,在B机器上执行
...全文
195 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
对不知道是怎么回事高手指点
一笑拔剑 2006-08-18
  • 打赏
  • 举报
回复
进程忙?
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
报的信息是:
this action cannot be completed because the other appliction is busy.
chose 'switch to' to activate the busy application and corect the problem
fxy_2002 2006-08-18
  • 打赏
  • 举报
回复
WMI编程资料,自己研究一下:
http://www.pc-soft.cn/blogview.asp?logID=33
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
192.168.0.166是B机器
send.exe 192.168.0.171 19000 sdsdfsd,是一个发送程序
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
不知道却少什么组件,程序报缺少组件
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Dim bl As Boolean
bl = RunExeAtComputer("192.168.0.166", "c:\1\send.exe 192.168.0.171 19000 sdsdfsd")
MsgBox "³É¹¦"
End Sub


Function RunExeAtComputer(ByVal strComputer As String, ByVal exeFile As String) As Boolean
Dim objWMIService As Object
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

Dim ErrReturn As Long, intProcessID As Integer
ErrReturn = objWMIService.Create(exeFile, Null, Null, intProcessID)

Set objWMIService = Nothing

If ErrReturn = 0 And intProcessID <> -1 Then RunExeAtComputer = True
End Function
fxy_2002 2006-08-18
  • 打赏
  • 举报
回复
当然是目标机器,即是B,exefile 也是指B上的文件,可以带路径,但是 B 上的路径。

比如 B机器上E盘有个 ab.exe

?RunExeAtComputer("B","e:\ab.exe")


还有你必须要有足够的权限访问B,不然会提示你拒绝的权限!
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
A,B机器的wmi 服务已经开启了啊,exeFile中是不是要写.EXE文件的全路径,应该怎么写
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
strComputer是指的A机器还是B机器
fxy_2002 2006-08-18
  • 打赏
  • 举报
回复
应该是没有开启 wmi 服务,对方必须是 2k/xp 系统

并且启动后的 exe 文件是后台运行的,看得到进程,但没有画面。
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")执行到这里的时候系统报了一个信息,不能执行下去了,是什么原因
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
执行到这里的时候系统报了一个信息,不能执行下去了,是什么原因
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")针对这句话,B机器上应该做什么样的设置呢
fxy_2002 2006-08-18
  • 打赏
  • 举报
回复
用 wmi:

'在其它电脑上运行指定 exe 文件
Function RunExeAtComputer(ByVal strComputer As String, ByVal exeFile As String) As Boolean
Dim objWMIService As Object
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

Dim ErrReturn As Long, intProcessID As Integer
ErrReturn = objWMIService.Create(exeFile, Null, Null, intProcessID)

Set objWMIService = Nothing

If ErrReturn = 0 And intProcessID <> -1 Then RunExeAtComputer = True
End Function
benyfeifei 2006-08-18
  • 打赏
  • 举报
回复
VB里实现的方法就是使用DCOM

建立一个ActiveX EXE程序(生成文件时选择“远程服务器文件”),并在B机器上进行部署

在A机器注册EXE文件的类型库,并引用,然后进行远程调用就行了。
一笑拔剑 2006-08-18
  • 打赏
  • 举报
回复
telnet?
如果是程序方面的实现必须b机器上有个服务端
来运行a机器要求的命令
csdnhw 2006-08-18
  • 打赏
  • 举报
回复
如何才能做到

7,757

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧