从文本文件批处理获取启动参数

时间:2013-05-23 11:14:46

标签: windows batch-file

如何使用文本文件中的参数启动程序? Batch.bat

@textFile = "c:\Users\Arguments.txt";
start "" "C:\Users\coffee.cmd" --join test.js --compile @textFile 

Arguments.txt

test5.coffe 
test2.coffe

1 个答案:

答案 0 :(得分:2)

@echo off
set arg_file=textFile
setlocal EnableDelayedExpansion
for /f "usebackq delims=" %%A in ("%arg_file%") do (
   set "argline=!argline! %%A"
) 
start "" "C:\Users\coffee.cmd" --join test.js --compile !argline!
endlocal