RunWait(@COMSPEC & " /c Start win.exe")
我想使用AutoIt搜索并运行子目录中的.exe文件。
我尝试使用路径名RunWait()
,这很好用。但我希望搜索,因为我的子文件夹每天都会更改。
答案 0 :(得分:0)
如何在子目录中查找并运行exe文件
_FileListToArrayRec()
找到子文件夹(和-files)。
我尝试使用带有路径名的runwait,但是我想搜索,因为我的子文件夹每天都在不断变化。
使用#include <File.au3>
Global Enum $RFS_ERROR_RUN = 2
Global Const $g_sFileName = 'notepad.exe', _
$g_sFilePath = 'C:\', _
$g_sFileMsg = 'file : "%s"\n(sub-)folder : "%s"\nlocated at : "%s"\n'
_RunFromSubfolder($g_sFileName, $g_sFilePath)
Func _RunFromSubfolder(Const $sFile, Const $sFolder)
Local $sMessage = ''
Local $iError = 0, _
$iExtd = 0, _
$iPID = 0
Local Const $aItems = _FileListToArrayRec($sFolder, $sFile, $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH)
If @error Then
$iError = @error
$iExtd = @extended
Else
$sMessage = StringFormat($g_sFileMsg, $sFile, $sFolder, $aItems[1])
$iExtd = $aItems[0]
$iPID = Run($aItems[1])
If @error Then
$iError = $RFS_ERROR_RUN
$iExtd = @error
EndIf
ConsoleWrite($sMessage)
EndIf
Return SetError($iError, $iExtd, $iPID)
EndFunc
识别相关文件夹,并相应地设置Run()
&#39; s(或RunWait()
&#39; s)第一个参数。
示例:
file : "notepad.exe"
(sub-)folder : "C:\"
located at : "C:\...\...\notepad.exe"
控制台输出:
[queryPhotoCount countObjectsInBackgroundWithBlock:(nullable PFIntegerResultBlock(nullable )block ...