|
|
本帖最后由 freesoft00 于 2015-6-1 20:46 编辑
"Program Files (x86)\Internet Explorer\iexplore.exe"
"Program Files (x86)\Internet Explorer\F12Tools.dll"
"Program Files (x86)\Internet Explorer\ie9props.propdesc"
"Program Files (x86)\Internet Explorer\iedvtool.dll"
"Program Files (x86)\Internet Explorer\ieinstal.exe"
"Program Files (x86)\Internet Explorer\ielowutil.exe"
"Program Files (x86)\Internet Explorer\ieproxy.dll"
"Program Files (x86)\Internet Explorer\IEShims.dll"
Windows\System32\amdocl_ld64.exe
Windows\System32\amdocl64.dll
Windows\System32\amdmmcl6.dll
Windows\System32\amdocl_as64.exe
上面是1.txt中文本的样例,我需要截取路径和文件名称。- @echo off
- pushd %~dp0
- for /f "delims=" %%i in (1.txt) do (
- echo,%%~dpi333%%~nxi%
- )>>3.txt
- pause
复制代码 如果使用上面对代码,文件名称截取对了,但是路径不对,路径变为了绝地路径,
比如这个文本1.txt在e:\22\33目录存放,
批处理运行完成后解决的路径都是
e:\22\33\Program Files (x86)\Internet Explorer\333iexplore.exe
而不是我要的下面的解决
Program Files (x86)\Internet Explorer\333iexplore.exe
另外一个问题,如果路径中带有引号的,希望生成后继续有双引号,如果不带有双引号的,那么还保持不带有双 引号
现在的问题:
文本的路径中有*号的处理不正确,
c:\4444\*
"c:\5555\*"
最后通过下面兄弟的代码得到的是
#:*= 333 *
#:*= 333 *
所以不再对带有*号的做处理,批处理在判断末尾是*号的不再生成到3.txt文本中,就是过滤掉。
同时过滤到开头是:冒号的行,比如:
:Windows\System32\amdocl64.dll
这个就不再生成到3.txt文本中 |
|