在工作目录中获取完整的文件路径

Pro*_*ilk 0 autohotkey

#NoEnv
SetWorkingDir %A_ScriptDir%

FileRead, string, file.txt
MsgBox,0,, %string%
Run Code Online (Sandbox Code Playgroud)

因为:

SetWorkingDir %A_ScriptDir%
Run Code Online (Sandbox Code Playgroud)

我可以引用file.txt而不是明确它的路径,但对于一个项目,我需要完整的文件路径,但我不知道如何得到它.理想情况下,我不想使用FileSelectFile,因为这只会为用户添加另一个步骤.

有解决方案吗

250*_*501 5

使用文件循环和A_LoopFileLongPath:

Loop, Files, file.txt
{
    fullpath := A_LoopFileLongPath    
}
MsgBox, fullpath: %fullpath%
Run Code Online (Sandbox Code Playgroud)