【问题标题】:Why Function "if ProcessExist" Don't Work in Others Computers为什么函数“if ProcessExist”在其他计算机中不起作用
【发布时间】:2019-10-11 20:55:29
【问题描述】:

我正在尝试执行 IF ProcessExist。

在我的 win 10 64 位计算机上它可以工作,但是当我在其他 PC 上使用 win 7 或什至使用 win 10 执行时。它不执行。

 #AutoIt3Wrapper_UseX64=N
    If ProcessExists ("program.exe") Then
MsgBox ("", "Hold", "Test", 10)
    Exit
    Else
        #RequireAdmin
    Run(@ComSpec & " /c " & "C:\folder\file.bat", "", @SW_HIDE)
        EndIf

继续获得好像 program.exe 存在,但它不存在。

【问题讨论】:

    标签: autoit


    【解决方案1】:
    #RequireAdmin must be on the very top of your script.
    

    我认为编译可执行文件时它不起作用。它可能被称为 program.exe,它正在寻找自己的进程。

    至于单身人士见this:

    _Singleton ( $sOccurrenceName [, $iFlag = 0] )
    Enforce a design paradigm where only one instance of the script may be running
    

    例子

    #include <Misc.au3>
    #include <MsgBoxConstants.au3>
    
    If _Singleton("test", 1) = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of test is already running")
        Exit
    EndIf
    MsgBox($MB_SYSTEMMODAL, "OK", "the first occurrence of test is running")
    

    【讨论】:

    • 我认为编译可执行文件时它不起作用。它可能被称为 program.exe,它正在寻找自己的进程。 谢谢,我使用的名称与我的 exe 相同。现在可以了。
    猜你喜欢
    • 1970-01-01
    • 2022-11-15
    • 2016-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多