有没有办法从 .ahk 文件中读取变量并在另一个批处理脚本文件中使用它
Is there a way to read a variable from a .ahk file and use it in another batch script file
我不知道读取另一个文件中的另一个变量的好方法
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 脚本在同一个目录中才能正常工作
我不知道读取另一个文件中的另一个变量的好方法
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 脚本在同一个目录中才能正常工作