我正在编写一个测试脚本以递归地遍历目录,并执行一系列步骤以将动态创建的文件自动上载到我的开发服务器。我在使用正确的语法时遇到了麻烦。我希望有人能帮助我。
我检查了堆栈溢出,并弄清了脚本的基本结构。
::
:: SUMMARY
:: --------------------------------------------------------------------------------------------------
:: Loops through a series of directories and executes the following steps for each directory
:: 1) Execute batch command which runs a SQL query and exports a list of IDs to a file in the
:: Current subdirectory called ids.txt
:: 2) Execute an exe that exists in a subdirectory of the directory where the batch file is run
:: that takes the list of IDS and creates CSV files with pre-created test data
::
:: TODOS
:: --------------------------------------------------------------------------------------------------
:: 1) Execute sqlcmd inline instead of calling a seperate batch file
:: 2) Execute a process to upload the generated CSV files to DEV server
:: 2) Skip any directory that is missing the .sql file or the
::
:: NOTES
:: --------------------------------------------------------------------------------------------------
:: - The process can (and should if possible) be run in parallel for each subdirectory, but the
:: steps for each subdirectory should be run in series
::
@echo off
set back = %cd%
for /R ./ %%i in (.) do (
cd "%%i"
call "./RunSql.bat" ids.txt
:: Run the genreate statements exe in the base folder
start /WAIT "%back%/CreateStatements/CreateStatements.exe" --background=true --idFile=ids.txt
)
cd %back%
我希望批处理文件遍历目录并运行注释中概述的步骤,但是我得到了每个目录的以下输出
'“ ./ RunSql.bat”'无法识别为内部或外部命令, 可操作的程序或批处理文件。 系统找不到文件--background = true。