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联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Closed] What is the reason why the dir command cannot find the file when querying the directory?
View 1,874 Replies 4
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
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.
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?
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.