1.

Solve : Batch File setting Attributes?

Answer»

I'm not sure iv asked this correctly before because others never give the right answer(Even Google couldn't find it LOL).

I'm wondering if a batch file can change the attribute(Read-only, HIDDEN and, Archive) of a file, and if so what is the command.

I'm trying WRITE a batch file that can set a normal file to a hidden attribute.

This is what i have so far:

" start view.exe /shtml view.html "

Is there a way to ADD a command so it saves/changes it to a hidden attribute? Or write another batch to would run after that and change it to Hidden attribute.

-Thanks in advance
TutsuoWelcome to the CH forums.

Use the ATTRIB command to set attributes. Enter ATTRIB/? in the command line to view parameters.

Good lucki dont understand... so

" start view.exe /shtml attrib/hidden view.html "

?Quote

start view.exe

Is view a Windows program? It is not in my XP system.
Why would you need to make the file hidden? If it is in a system area the average user is not going to see it. And if he is a super user he will find it anyway.
the program is run from a usb flash drive. . .
I don't understand either.... Here are the parameters (switches) for the Attrib command...
Quote
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
[/S [/D]]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.


To hide a file use

ATTRIB +H DRIVE\PATH\FILENAME

Example:
attrib +h F:\view.exe

or

attrib +h f:\idontknow\whodoes.exe


Hmm ill try that out.


Discussion

No Comment Found