2016-11-13 38 views
0

我做了一个批处理脚本,但它似乎有点破损,因为当我运行它时,只有其中一个搜索出现在控制台中。我需要的是一个批处理脚本,它搜索C:\以获取字符串和文件名。这是我的。在计算机上搜索多个项目的批处理文件

@echo off 
findstr /m "vape" *.* > vf-log.txt 
if %errorlevel%==0 (
echo. 
echo Vape strings found. 
) else (
echo. 
echo No strings found. 
) 
dir /S C:\vape.* > vf-log.txt 
if %errorlevel%==0 (
echo. 
echo Vape files found. 
) else (
echo. 
echo No files found. 
) 
dir /S C:\harambe.* > vf-log.txt 
if %errorlevel%==0 (
echo. 
echo Harambe files found. 
) else (
echo. 
echo No files found. 
) 
dir /S C:\kurium.* > vf-log.txt 
if %errorlevel%==0 (
echo. 
echo Kurium files found. 
) else (
echo. 
echo No files found. 
) 
dir /S C:\clicker.* > vf-log.txt 
if %errorlevel%==0 (
echo. 
echo Autoclicker files found. 
) else (
echo. 
echo No files found. 
) 
start "" "C:\Users\%USERNAME%\Desktop\vf-log.txt" 
pause 

我可能做错了什么。


编辑:我现在有这个。 Prefetch中有一个名为VAPE-LAUNCHER的文件,即使我正在使用dir,它也不会启动。帮帮我?

@echo off 
echo Loading... 
echo. 
dir C:\vape*.* /s /b >> vf-log.txt 
if %errorlevel%==0 (
echo Files found! 
) else (
echo. 
echo No files found. 
) 
start "" "C:\Users\%USERNAME%\Desktop\vf-log.txt" 
pause 
+1

'''每次都会覆盖你的文件。要追加,使用'>>' – Stephan

+0

它仍然只是表示“Vape Strings Found”,没有其他的东西我告诉它说。另外,我可以使文本文件更清洁吗?这只是一堆东西。 – Quizzed

+0

'Dir c:\ windows \ user *。* C:\ windows \ shell *。*' – 2016-11-13 18:55:08

回答

0

>表示 “创建该文件新活
>>意味着 “附加到这个文件或创建它,如果它不存在”

顺便说一句 - 你可以尝试

findstr /m /L /c:"string1" /c:"string2" /c:"string3".... 

findstr /m /g:"filename.txt" ... 

找到多个字符串(filename.txt包含字符串一到A线)

,同样,

dir /s c:\string1.* c:\string1.* .... 

将向您展示多个文件匹配,匹配

dir /s /b....会给你filenames-只有(如从findstr /m

+0

缺少文件:可能该文件具有“隐藏”或“系统”属性集,您需要使用'/ ah'或'/ as'开关重新运行'dir'。如果不行,请仔细查看文件名。可能做一个'dir',它将显示文件名,将'dir'输出重定向到一个文本文件并使用像editplus这样的像样的编辑器来检查结果,或者使用十六进制编辑器来确保文件名不会被损坏某种方式。 – Magoo

相关问题