标题: [文本处理] [已解决]批处理怎样写入完整路劲到TXT中? [打印本页]
作者: heroxianf 时间: 2011-5-4 08:03 标题: [已解决]批处理怎样写入完整路劲到TXT中?
本帖最后由 heroxianf 于 2011-5-4 12:58 编辑
任意一个文件夹下 比如 D:/ICO 文件夹里有 1.ico、2.ico
使用批处理写入test.txt里的内容是
go "d:/ico/1.ico"
go "d:/ico/2.ico"
请坛友帮帮忙!
作者: heroxianf 时间: 2011-5-4 08:13
- @echo off
-
- DIR /B >>test.txt
- for /f "tokens=*" %%a in (.\test.txt) do (
- for /r %CD% %%j in (%%a) do (
- if exist %%j (
- echo %%j>>text_new.txt
- )
- )
- )
复制代码
我用它能实现文件完整路径写入TXT 但是如何加一个 “go”
作者: heroxianf 时间: 2011-5-4 08:27
- @echo off
-
- REM 清理TXT
- del /q test.txt
- del /q text_new.txt
-
- DIR /B >>test.txt
- for /f "tokens=*" %%a in (.\test.txt) do (
- for /r %CD% %%j in (%%a) do (
- if exist %%j (
- echo "%%j">>text_new.txt
- )
- )
- )
复制代码
这样就能给每个路径加上双引号了! 请坛友帮忙 加“go”
作者: hucuibai 时间: 2011-5-4 10:14
- @echo off
- for /r D:/ICO %%i in (*..ico) do (
- >test.txt (echo go "%%i")
- )
复制代码
作者: heroxianf 时间: 2011-5-4 11:23
4# hucuibai
谢谢 试了下能实现~
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |