标题: 如何在文本文件中修改内容?批处理中
[打印本页]
作者: mangyuan
时间: 2009-1-1 07:38
标题: 如何在文本文件中修改内容?批处理中
比如修改BOOT。INI文件的time=30为time=3,谢谢各位高手顺便指点下
作者: hackerscans
时间: 2009-1-1 10:20
我这里不能打开boot.ini啊。。
作者: glbosom
时间: 2009-1-1 10:31
如果你的用户不是管理员的话批处理也做不了的。
作者: HAT
时间: 2009-1-1 10:31
作者: radem
时间: 2009-1-1 11:09
@echo off&attrib -s -h -r c:\boot.ini
for /f "delims=" %%i in (c:\boot.ini) do (
echo.%%i | findstr/i "timeout=">nul && echo timeout=3||echo %%i
)>>c:\boot.new
move c:\boot.new c:\boot.ini
attrib +s +h +r c:\boot.ini
作者: HAT
时间: 2009-1-1 11:11
标题: Re 5楼
move应该加个/y开关吧(不加也可,见10楼讲解。)
[ Last edited by HAT on 2009-1-1 at 21:21 ]
作者: radem
时间: 2009-1-1 11:18
不加也可以
作者: HAT
时间: 2009-1-1 18:20
标题: Re 7楼
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Test>type nul>a.txt
C:\Test>echo hat>b.txt
C:\Test>move b.txt a.txt
Overwrite C:\Test\a.txt? (Yes/No/All): y
C:\Test>echo hat>c.txt
C:\Test>move /y c.txt a.txt
作者: mangyuan
时间: 2009-1-1 19:48
谢谢radem和各位指导,我知道怎么弄了哈~原来FOR命令可以修改文件内部信息~谢谢哈~
作者: radem
时间: 2009-1-1 20:36
Originally posted by HAT at 2009-1-1 06:20 PM:
[box=#000000]Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Test>type nul>a.txt
C:\Test>echo hat>b.txt
C:\Test>move b.txt a ...
谢谢斑竹测试,但用P实现时不用/y开关也没有确认提示