中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-06 03:02
48,039 topics / 350,124 posts / today 2 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » (Solved) How to hide the results displayed during the for search file process
Printable Version  2,185 / 23
Floor1 bd540 Posted 2007-10-10 13:17
初级用户 Posts 49 Credits 114
This code displays messages like "Device not ready", "File not found" when running. How to hide these messages? I added >NUL in several places but got errors.



[ Last edited by bd540 on 2007-10-11 at 02:28 AM ]
Floor2 wudixin96 Posted 2007-10-10 13:40
银牌会员 Posts 931 Credits 1,928
Floor3 bd540 Posted 2007-10-10 13:57
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 13:40:
2>nul

Thanks, please tell me where to specifically add it?
Floor4 wudixin96 Posted 2007-10-10 14:23
银牌会员 Posts 931 Credits 1,928
Floor5 bd540 Posted 2007-10-10 14:37
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 14:23:
Where is the dir

It doesn't work. Can you help post the modified one? Thanks a lot.
Floor6 wudixin96 Posted 2007-10-10 14:44
银牌会员 Posts 931 Credits 1,928
Is your purpose to find the directory where avp.exe is located and then switch to that directory? Right?
Floor7 bd540 Posted 2007-10-10 14:59
初级用户 Posts 49 Credits 114
Floor8 wudixin96 Posted 2007-10-10 15:12
银牌会员 Posts 931 Credits 1,928
@echo off
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do (
dir /a /b /s "%%a:\avp.exe">nul 2>nul
if not errorlevel 1 for /f "delims=" %%i in ('dir /a /b /s "%%a:\avp.exe"') do start "" "%%~dpi"
)
pause

What does this mean?
Floor9 bd540 Posted 2007-10-10 15:31
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 15:12:
@echo off
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do (
dir /a /b /s "%%a:\avp.exe">nul 2>nul
if not errorlevel 1 for /f "delims=" %%i in ('dir ...

Thanks, OK.
Floor10 bd540 Posted 2007-10-10 15:40
初级用户 Posts 49 Credits 114
There is another question. Your command opens all the files found by the search. How to open only the first one found by the search?
Floor11 wudixin96 Posted 2007-10-10 15:44
银牌会员 Posts 931 Credits 1,928
Then find the first one, start it, and then exit.
Floor12 bd540 Posted 2007-10-10 16:49
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 15:44:
Then just find the first one, start it, and then exit.

Can GOTO be used?
Floor13 bd540 Posted 2007-10-10 17:26
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 15:44:
Then just find the first one, start it, and exit.

Can't handle it, looking forward to a reply.
Floor14 wudixin96 Posted 2007-10-10 17:51
银牌会员 Posts 931 Credits 1,928
How did you write it?
Floor15 bd540 Posted 2007-10-10 17:56
初级用户 Posts 49 Credits 114
Originally posted by wudixin96 at 2007-10-10 17:51:
How did you write it??

:P I'm not very familiar with DOS, and I'm not familiar with some basic commands. The above code was still pieced together by searching the forum, so please give me the complete command :D
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023