Batch file 从文件批量加载多个自定义命令

Batch file 从文件批量加载多个自定义命令,batch-file,load,command,Batch File,Load,Command,我在Google和Stack Overflow上搜索了相当长一段时间,但我找不到任何帮助和解决方案 我有一个名为settings.ini的文件,我想让用户向其中添加自定义命令 命令必须是这样的:.CustomCommand=ExecuteCommand for /f "delims=.= tokens=2" %%a in ('more settings.ini ^| findstr "="') do (set customcommand=%%a)` 它不太好用,人们告诉我使用for命令,但没有

我在Google和Stack Overflow上搜索了相当长一段时间,但我找不到任何帮助和解决方案

我有一个名为
settings.ini
的文件,我想让用户向其中添加自定义命令

命令必须是这样的:
.CustomCommand=ExecuteCommand

for /f "delims=.= tokens=2" %%a in ('more settings.ini ^| findstr "="') do (set customcommand=%%a)`
它不太好用,人们告诉我使用
for
命令,但没有成功

你能帮我解决吗?

相反,你需要这个:

@echo off
for /f "eol=; tokens=1,2 delims=.=" %%a in ('more settings.ini ^| findstr "="') do (set %%~a=%%~b)
您可以调用包含
%

或者您可以使用:

@echo off
for /f "eol=; tokens=1,2 delims=.=" %%a in ('more settings.ini ^| findstr "="') do (echo %%~b>%%~a.bat)
对于直接调用(即使您可以在
%PATH%
中设置生成的
bat


eol=
用于跳过以
开头的行-ini文件的标准注释。

请向我们展示“settings.ini”的一部分。解决方案通常取决于它的外观。#---自定义命令注意:每个自定义命令都必须以开头。symbol.a=autoclean-debug.thiscommandisreallyepic=run dfex.exe-debugI无法在注释上创建换行符,因此注释混乱不堪