问题描述
FileReader.bat
@echo off
:: Some how read VarX in the ahk file and then save it as another variable
SET VarXReading=%VarX%
echo %VarXReading%
pause
FiletoBeRead.ahk
VarX = 69420
解决方法
您可以将该变量作为参数传递给批处理文件。例如
ahk 脚本:
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Do whatever you need to here
VarX := 69420
Run batch.bat %VarX%
批处理脚本:
@echo off
SET VarXReading=%1
echo %VarXReading%
pause
只需确保批处理脚本和 ahk 脚本在同一目录中即可使用