中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 21:29
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Question about inserting into each line
Printable Version  804 / 5
Floor1 29yzh Posted 2007-03-24 11:27
新手上路 Posts 7 Credits 18
How can I use a batch file to insert a piece of text at the beginning or end of each command line in another batch file

Thanks~~~
Floor2 lxmxn Posted 2007-03-24 11:28
版主 Posts 4,938 Credits 11,386
Could you give an example so we can take a look?
Floor3 29yzh Posted 2007-03-24 12:19
新手上路 Posts 7 Credits 18
I'm trying to add echo off to the beginning of the commands in each batch file (just as an example)

Add echo off before the following commands
sfc /purgecache
sfc /purgecache
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\*.log
del /f /s /q %windir%\*.tmp
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
rd /s /q %temp% & md %temp%
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"

Make it become:

echo off sfc /purgecache
echo off sfc /purgecache
............................................
Floor4 29yzh Posted 2007-03-24 12:23
新手上路 Posts 7 Credits 18
Or for
regsvr32 actxprxy.dll
regsvr32 shdocvw.dll
regsvr32 oleaut32.dll
Regsvr32 URLMON.DLL
add /s so it becomes
regsvr32 /s actxprxy.dll
regsvr32 /s shdocvw.dll
regsvr32 /s oleaut32.dll
Regsvr32 /s URLMON.DLL
Floor5 lxmxn Posted 2007-03-24 12:31
版主 Posts 4,938 Credits 11,386
Replying to the post above, you can try solving the problem in post #3 by following this example:
Floor6 29yzh Posted 2007-03-24 12:43
新手上路 Posts 7 Credits 18
Thanks, I'll give it a try
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023