Board logo

标题: 请教 在每行插入 [打印本页]

作者: 29yzh     时间: 2007-3-24 11:27    标题: 请教 在每行插入

如何用批处理实现将一段文字插入另一个批处理每一段命令的头或尾

   谢谢~~~
作者: lxmxn     时间: 2007-3-24 11:28
举个例子来看看?
作者: 29yzh     时间: 2007-3-24 12:19
我在把 echo off 加入每个批处理文件中的命令头(打个比方)

echo off 加入以下命令头
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\*.*"

让它变成:

echo off sfc /purgecache
echo off sfc /purgecache
............................................
作者: 29yzh     时间: 2007-3-24 12:23
或者在
regsvr32 actxprxy.dll
regsvr32 shdocvw.dll
regsvr32 oleaut32.dll
Regsvr32 URLMON.DLL
加入 /s 变成
regsvr32 /s actxprxy.dll
regsvr32 /s shdocvw.dll
regsvr32 /s oleaut32.dll
Regsvr32 /s URLMON.DLL
作者: lxmxn     时间: 2007-3-24 12:31
回楼上的,你可以试着照这个例子去解决3楼的问题:
@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

作者: 29yzh     时间: 2007-3-24 12:43
谢谢, 我试试看