Original Poster
Posted 2007-03-24 11:27 · 中国 福建 三明 电信
新手上路
★
Credits 18 Posts 7 Joined 2006-12-20 00:26 19-year member UID 73981 Gender Male
Status Offline
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~~~
Floor 2
Posted 2007-03-24 11:28 · 中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386 Posts 4,938 Joined 2006-07-23 17:10 20-year member UID 59080
Status Offline
Could you give an example so we can take a look?
Floor 3
Posted 2007-03-24 12:19 · 中国 福建 三明 电信
新手上路
★
Credits 18 Posts 7 Joined 2006-12-20 00:26 19-year member UID 73981 Gender Male
Status Offline
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
............................................
Floor 4
Posted 2007-03-24 12:23 · 中国 福建 三明 电信
新手上路
★
Credits 18 Posts 7 Joined 2006-12-20 00:26 19-year member UID 73981 Gender Male
Status Offline
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
Floor 5
Posted 2007-03-24 12:31 · 中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386 Posts 4,938 Joined 2006-07-23 17:10 20-year member UID 59080
Status Offline
Replying to the post above, you can try solving the problem in post #3 by following this example:
@echo off
del __new.bat 2>nul
for /f "tokens=1*" %%a in (test.txt) do (
echo %%a /s %%b>>__new.bat
)
start notepad __new.bat
Floor 6
Posted 2007-03-24 12:43 · 中国 福建 三明 电信
新手上路
★
Credits 18 Posts 7 Joined 2006-12-20 00:26 19-year member UID 73981 Gender Male
Status Offline
Thanks, I'll give it a try
Forum Jump:
— Select —
站务公告 & 版主讨论
意见反馈 & 网友交流
DOS学习入门 & 精彩文章 (教学室)
DOS疑难解答 & 问题讨论 (解答室)
DOS启动盘 & LOGO技术 (启动盘室)
DOS批处理 & 脚本技术(批处理室)
DOS媒体世界 & 网络技术 (多媒体室)
DOS汉化世界 & 中文系统 (中文化室)
DOS开发编程 & 发展交流 (开发室)
DOS软件下载 & 游戏分享 (下载室)
GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区
其它操作系统综合讨论区
WinPE、PowerShell及其它命令行系统专区
贴图灌水、文学娱乐专区
网络日志(Blog)
论坛回收站
├ 链接失效,待修正