自从我上次使用 Windows 以来已经有很长时间了,所以我需要一些关于我正在尝试创建的简单脚本的帮助。简而言之,我想生成一个脚本,它根据文件列表创建一些文件。令我恼火的是,在 for 循环的执行过程中,在处理完第二个元素之后,我开始在输出中看到代码实际执行之前的 for 循环代码本身。此外,我最后一个更改目录的命令从未执行过,我认为原因是我拥有的 goto:eof 语句。有人可以帮我适当地编辑脚本吗?
这是脚本:
@echo off
set "myroot=%cd%"
set "scriptsroot=%myroot%\public\javascripts"
set "cdstr=Changing directory"
echo.%cdstr%
cd %scriptsroot%
set "mainmsg=Generating bundles"
echo.%mainmsg%
set "corefiles="definitions resources representation something""
call:myConverter %corefiles%
set "cdstr=Changing directory"
echo.%cdstr%
cd %myroot%
:myConverter
set list=%~1
(for %%f in (%list%) do (
echo.- Bundle for %%f
browserify %%f.js -o %%fBundle.js
))
goto:eof