运行 包含 autohotkey 字符串的文件夹内的文件

Running a file inside a folder that contains string in autohotkey

我需要 运行 始终更改版本的文件夹中的文件。 我试过 运行 "E:\Test.\TestScript.exe" 而 Test. 物理上是 Testv1.22 但显然我需要一个正则表达式命令来 运行 它,我不知道该怎么做。 任何帮助将不胜感激。

我首先遍历了提供的目录中的所有 exes (E:\Test\)。

接下来,我在循环当前迭代的当前文件名上使用RegExMatch作为大海捞针,Testv.*Script.exe作为针

此指针将允许 "Testv"+[any combination of characters]+"Script.exe" 格式的文件名被接受为匹配项。

如果匹配,那么我运行当前文件的完整路径,启动exe。


最终代码:

Loop, Files, E:\Test\*.exe
{
    ;MsgBox %A_LoopFileName% ;uncomment to see the file currently being iterated
    if(RegExMatch(A_LoopFileName, "Testv.*Script.exe")){
        run %A_LoopFilePath%
    }
}