@echo off
for %%a in (c d e f g h i) do (
if exist %%a:\nul 2>nul (
for /f "tokens=*" %%b in ('dir /s/b/a %%a:\amped.exe') do echo %%~dpb>C:\1.txt
))
::del %0批处理总是会弹个黑框很不爽,希望高手能帮我把这段批处理转变成VBS的!谢
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off
for %%a in (c d e f g h i) do (
if exist %%a:\nul 2>nul (
for /f "tokens=*" %%b in ('dir /s/b/a %%a:\amped.exe') do echo %%~dpb>C:\1.txt
))
::del %0 sFile = "c:\1.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(sFile,2,True)
sWQL = "Select * From CIM_DataFile Where " & _
"FileName = 'amped' And Extension = 'exe'"
For Each itemFile In GetObject("Winmgmts:").ExecQuery(sWQL)
oFile.WriteLine itemFile.name
Next
oFile.Close
MsgBox "执行完毕!"
| 评分人 | 分数 | 时间 |
|---|---|---|
| heicai | +2 | 2007-07-11 20:59 |
Originally posted by 3742668 at 2007-7-11 09:18 PM:
如果只要路径的话可以把倒数第四行的itmeFile.Name 替换为:
itemFile.Drive & itemFile.Path
sFile = "c:\1.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(sFile,2,True)
sWQL = "Select * From CIM_DataFile Where " & _
"FileName = 'amped' And Extension = 'exe'"
For Each itemFile In GetObject("Winmgmts:").ExecQuery(sWQL)
oFile.WriteLine itemFile.Drive & itemFile.Path
Next
oFile.Close
MsgBox "执行完毕!"
Originally posted by 3742668 at 2007-7-11 09:33 PM:
自己多学学基础的东西吧。
sFile = "c:\1.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(sFile,2,True)
sWQ ...
另外我试了下你的代码,发现无法处理中文目录。:(