.exe 无法在 AutoIt 中打开?

.exe won't open in AutoIt?

我想在 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 通常打开时,安装工作非常好。

虽然我不知道为什么 Run() 在这里不起作用,但您可以尝试使用 ShellExecute()