Exe(file){ Loop,%file% Filename:=RegExReplace(A_LoopFileShortName,"\.[^\.]*$") Loop,%A_AhkPath% path:=A_LoopFileDir FileMove,%A_AhkPath%,%path%\%FileName%.exe If ErrorLevel Return ErrorLevel Loop Loop,%path%\%FileName%.exe { Run %A_LoopFileFullPath% "%file%",% RegExReplace(file,"\\[^\\]*$"),,PID Process,Wait,%Pid%,5 FileMove,%A_LoopFileFullPath%,%A_AhkPath% Process,Wait,%Pid%,0.1 Return ErrorLevel } }