China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 14:52
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Closed] What is the reason why the dir command cannot find the file when querying the directory? View 1,874 Replies 4
Original Poster Posted 2006-03-29 18:19 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Please ask the following question in English: "What are the possible reasons why the dir command cannot find the file in the command line? The computer is running Windows XP SP2 operating system, and the system partition is in NTFS format, while drive K is in FAT32 format.

"Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\jm>dir k:
Volume in drive K is Temporary Data
Volume Serial Number is CC6E-12A2

Directory of K:\

File not found"

[ Last edited by willsort on 2006-3-30 at 10:00 ]
Floor 2 Posted 2006-03-29 18:31 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Check if "dir /a k:" works.
Floor 3 Posted 2006-03-29 21:47 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
After checking for a long time, I finally figured out what was going on.
It turned out that it was because the batch processing program was set incorrectly, setting all the files in drive K to the system attribute, resulting in the dir command being unable to obtain the directory list.
Floor 4 Posted 2006-05-25 00:57 ·  中国 江西 南昌 电信
初级用户
Credits 55
Posts 29
Joined 2006-04-11 16:40
20-year member
UID 53669
Gender Male
From 亚洲
Status Offline
attrib +h /s %drive%\*.exe
Put this batch file in drive D to hide only .exe files on this drive.
If you want to hide .exe files on all drives, how to set the environment variable?
SET can also set environment variables... Can SET replace %?
How to write it then?
Floor 5 Posted 2006-05-25 13:38 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Originally posted by jun19841 at 2006-5-25 00:57:
attrib +h /s %drive%\*.exe
Put this batch file in drive D to hide only .exe files in this drive.
If you want to hide .exe files in all drives, how to set the environment variables?
SET can also set environment variables..


You need to use the for statement to list all drives. The code is as follows:

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist %%a:\recycled\nul attrib +h /s %%a:\*.exe
if exist %%a:\recycler\nul attrib +h /s %%a:\*.exe
)


Dare not test it actually, but think that attrib +h /s %%a:\*.exe seems difficult to operate on all .exe files.

[ Last edited by namejm on 2006-5-25 at 13:46 ]
Forum Jump: