[英]Python: Provide a string, open folder that contains the string in the folder name, then open/read a file in that folder
[英]Running a file inside a folder that contains string in autohotkey
我需要在始终更改版本的文件夹中运行文件。 我尝试在测试时运行“E:\Test.\TestScript.exe”。 物理上是 Testv1.22 但显然我需要一个正则表达式命令来运行它,我不知道该怎么做。 任何帮助,将不胜感激。
我首先遍历了提供的目录( E:\Test\
)中的所有 exe。
接下来,我在循环的当前迭代的当前文件名上使用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%
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.