echo命令

来源:百度知道 编辑:UC知道 时间:2024/05/09 04:20:05
请教如何用一个ECHO和一个重定向命令得到形如下面的格式:
echo use test >dbcc.sql
echo go >>dbcc.sql
echo checkpoint >>dbcc.sql
echo go >>dbcc.sql
echo select 'Update Statistics for test:' >>dbcc.sql
echo go >>dbcc.sql
echo select getdate(),'----- mbr' >>dbcc.sql
echo go >>dbcc.sql
echo update statistics mbr >>dbcc.sql
echo go >>dbcc.sql

^>符号可以输出为>.
把下边的代码存为.bat执行就行了。

echo echo use test ^>dbcc.sql >test.txt
echo echo go ^>^>dbcc.sql >>test.txt
echo echo checkpoint ^>^>dbcc.sql >>test.txt
echo echo go ^>^>dbcc.sql >>test.txt
echo echo select 'Update Statistics for test:' ^>^>dbcc.sql >>test.txt
echo echo go ^>^>dbcc.sql >>test.txt
echo echo select getdate(),'----- mbr' ^>^>dbcc.sql >>test.txt
echo echo go ^>^>dbcc.sql >>test.txt
echo echo update statistics mbr ^>^>dbcc.sql >>test.txt
echo echo go ^>^>dbcc.sql >>test.txt