找回密码
 加入
搜索
查看: 12467|回复: 2

[系统综合] 关于Run和ShellExecute这两个函数会不支持UNC怎么破啊?

[复制链接]
发表于 2013-8-20 09:55:14 | 显示全部楼层 |阅读模式
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Jack>"W:\Game_Install_all\Battlefield bad company\Setup.exe"

C:\Users\Jack>"\\192.168.8.198\autoserv\Game_Install_all\Battlefield bad company
\Setup.exe"

C:\Users\Jack>"W:\Game_Install_all\Battlefield bad company\Setup.exe"

C:\Users\Jack>"\\192.168.8.198\autoserv\Game_Install_all\Battlefield bad company
\Setup.exe"

C:\Users\Jack>"W:\Game_Install_all\Battlefield bad company\Setup.exe"

C:\Users\Jack>cd "\\192.168.8.198\autoserv\Game_Install_all\Battlefield bad comp
any"
'\\192.168.8.198\autoserv\Game_Install_all\Battlefield bad company'
CMD does not support UNC paths as current directories.


我用Run和ShellExecute函数对Setup.exe  run不起来耶,有没有大神可以帮忙一下啊

代码:

ConsoleWrite(_Battlefield_Installation("\\192.168.8.198\autoserv\Game_Install_all\Battlefield bad company\Setup.exe","\\192.168.8.198\autoserv\Game_Install_all\Battlefield Bad Company_DVD\BFBC2Game.exe"))
Func _Battlefield_Installation($Dir,$patch)
        Sleep(2000)
        If RegRead("HKLM64\SOFTWARE\Wow6432Node\Electronic Arts\Battlefield Bad Company 2","Install Dir") Or RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Arts\Battlefield Bad Company 2","Install Dir") Then
                Return 1
        EndIf
        ConsoleWrite($Dir&@CRLF&StringTrimRight($Dir,9))
        If ShellExecute($Dir,StringTrimRight($Dir,9)) == 0 Then
               
                return 0
        EndIf
EndFunc



我在Cmd模式下用C:\Users\Jack>"W:\Game_Install_all\Battlefield bad company\Setup.exe" 又可以运行对应的exe文件。W是值得\\192.168.8.198\autoserv的map盘符。两种方式为什么执行结果不一样??求解~~
发表于 2013-8-20 18:37:48 | 显示全部楼层
回复 1# ppp092


不是Run 和 ShellExecute 的问题, 而是批处理本来不支持UNC
你先映射网络目录到本地再处理就行了.
AU3 有函数 DriveMapAdd

评分

参与人数 1金钱 +20 收起 理由
ppp092 + 20 具有相同的解决方案~

查看全部评分

 楼主| 发表于 2013-8-21 08:45:00 | 显示全部楼层
回复 2# user3000


    嗯,Thx。。。不谋而合,我正是用这种方法。在自己定义的UDF里面需要用是就Map一个盘并得到盘符。用完之后就删除掉。谢谢你~~user3000
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-22 10:10 , Processed in 0.082655 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表