我正在嘗試創建一個簡單的文件合併工具,將分割日誌文件合併到文本文件中。如何通過AutoHotKey將參數傳遞給內置的Windows命令?
FileSelectFolder, folder, \\Myserver\Data\
InputBox, filename, Save File,Please type the name you will call the merged file.`n The file will be saved in the folder "merged" of the same root directory as its "part files" are located., , , , , , , ,merged_file.txt
if errorlevel = 1
exitApp
IfExist, %folder%\merged\%filename%
MsgBox, 4, File Overwrite -or- Append?, The file already exists. Do you want to append to this file? `nNote: If you select "No" the existing file will be replaced during this process.
ifmsgbox, no
FileDelete %folder%\merged\%filename%
FileCreateDir, %folder%\merged
IfExist %folder%\merged\%filename%_file_list.txt
FileDelete %folder%\merged\%filename%_file_list.txt
Runwait, %COMSPEC% /c copy /k %folder%\*.log %folder%\merged\%filename%
ExitApp
我並不想用AHK FILEREAD和fileappend日誌文件相當大〜40MB。
上面的代碼不會產生任何錯誤,但不會產生任何文件。 我嘗試添加「的參數,但沒有成功。
我試了一下,仍然沒有運氣。感謝您的回覆 – rellik
是的,看起來沒有/ k開關複製命令。拿出來,也許它現在會工作。你有沒有看過AHK等價命令FileCopy? – errorseven
我試圖FileAppend和FileCopy不幸的是,我試圖合併的文件太大,FileRead存儲在內存中,並使用FileAppend追加。使用FileCopy它只複製一個文件作爲合併文件,不會將該文件夾中的所有文件作爲一個大文件追加。 – rellik