.exe不会在AutoIt中打开?

问题描述 投票:0回答:1

我想在Windows 10计算机上脱机安装.net Framework 3.5。奇怪的是,当我运行此脚本时,我的安装程序(C:\ DotNet_Win10.exe)无法启动:

Func _Au3RecordSetup()
    Opt('WinWaitDelay', 100)
    Opt('WinDetectHiddenText', 1)
    Opt('MouseCoordMode', 0)

    Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
    If $aResult[1] <> '00000407' Then
        MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000407->' & $aResult[1] & ')')
    EndIf
EndFunc

Func _WinWaitActivate($title, $text, $timeout = 0)
    WinWait($title, $text, $timeout)
    If Not WinActive($title,$text) Then WinActivate($title, $text)
    WinWaitActive($title, $text, $timeout)
EndFunc

_AU3RecordSetup()

Run('C:\DotNet_Win10.exe')

_WinWaitActivate("DotNet for Windows 10 x86 x64 Setup","")

Send("{ENTER}")
Sleep(20000)
Send("{TAB}{ENTER}")

_WinWaitActivate("DotNet for Windows 10 x86 x64 Setup ","")

Send("{ENTER}")

更重要的部分当然是下半部分。

为什么不打开?当我正常运行.exe时它只是打开,安装工作完全正常。

autoit
1个回答
0
投票

即使我不知道为什么Run()在这里不起作用,你也可以尝试使用ShellExecute()

© www.soinside.com 2019 - 2024. All rights reserved.