Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Change File Attributes

Reply
 
Old 08-09-2008   #1 (permalink)
Gary''s Student


 
 

Change File Attributes

I have a set of files in a folder and want to modify their properties. In
one folder I have a set of .asx files that I would like to un-block en-mass.
In another folder I have a set of .url files that I would like to protect
en-mass.

Win-XP SP3
--
Gary''s Student - gsnu2007xx

My System SpecsSystem Spec
Old 08-09-2008   #2 (permalink)
mayayana


 
 

Re: Change File Attributes

Quote:

> I have a set of files in a folder and want to modify their properties. In
> one folder I have a set of .asx files that I would like to un-block
en-mass.
Quote:

> In another folder I have a set of .url files that I would like to protect
> en-mass.
>
So what's the question? Do you expect someone
to just write the whole script for you? If not then
you need to be more specific about which part has
you stumped.


My System SpecsSystem Spec
Old 08-09-2008   #3 (permalink)
Pegasus \(MVP\)


 
 

Re: Change File Attributes


"Gary''s Student" <GarysStudent@xxxxxx> wrote in message
news:9EE80484-0F1B-40D0-9B46-672E8937EE52@xxxxxx
Quote:

>I have a set of files in a folder and want to modify their properties. In
> one folder I have a set of .asx files that I would like to un-block
> en-mass.
> In another folder I have a set of .url files that I would like to protect
> en-mass.
>
> Win-XP SP3
> --
> Gary''s Student - gsnu2007xx
attrib.exe is the usual command for such tasks.


My System SpecsSystem Spec
Old 08-09-2008   #4 (permalink)
mayayana


 
 

Re: Change File Attributes

Quote:

> attrib.exe is the usual command for such tasks.
>
In DOS, yes. In VBScript there's the FileSystemObject...
which provides access to folders as objects via GetFolder...
Each folder object has a Files collection object... each of
which has an Attributes property.


My System SpecsSystem Spec
Old 08-09-2008   #5 (permalink)
Pegasus \(MVP\)


 
 

Re: Change File Attributes


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:ekYb1dj%23IHA.2352@xxxxxx
Quote:

>
Quote:

>> attrib.exe is the usual command for such tasks.
>>
> In DOS, yes. In VBScript there's the FileSystemObject...
> which provides access to folders as objects via GetFolder...
> Each folder object has a Files collection object... each of
> which has an Attributes property.
I'm quite aware of that but since I'm lazy I prefer not to
re-invent the wheel. If I can do a job with a single-line command
then I won't write a ten-line VB Script file to do the same thing.

By the way, DOS? I thought DOS was a legacy operating system
introduced some 30 years ago and only rarely used these days?


My System SpecsSystem Spec
Old 08-09-2008   #6 (permalink)
Al Dunbar


 
 

Re: Change File Attributes


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:%234h22%23h%23IHA.872@xxxxxx
Quote:

>
Quote:

>> I have a set of files in a folder and want to modify their properties.
>> In
>> one folder I have a set of .asx files that I would like to un-block
> en-mass.
Quote:

>> In another folder I have a set of .url files that I would like to protect
>> en-mass.
>>
>
> So what's the question? Do you expect someone
> to just write the whole script for you? If not then
> you need to be more specific about which part has
> you stumped.
What has me stumped is what he means my "un-blocking" and "protecting". This
could be anything from simple changes to the "R" attribute to something more
detailed using NTFS permissions. Of course if you are "protecting" a file
with NTFS permissions, what are you protecting it from, modification?
deletion? being seen at all?

What doesn't have me stumped is the reason behind the question posed by
someone signing himself as "Gary's Student" - could this possibly be a
homework question?

/Al


My System SpecsSystem Spec
Old 08-09-2008   #7 (permalink)
mayayana


 
 

Re: Change File Attributes

Quote:
Quote:
Quote:

> >> attrib.exe is the usual command for such tasks.
> >>
> > In DOS, yes. In VBScript there's the FileSystemObject...
> > which provides access to folders as objects via GetFolder...
> > Each folder object has a Files collection object... each of
> > which has an Attributes property.
>
> I'm quite aware of that but since I'm lazy I prefer not to
> re-invent the wheel. If I can do a job with a single-line command
> then I won't write a ten-line VB Script file to do the same thing.
>
That's fine. It's just that this is a VBS group.
It might be a bit confusing to newcomers who
expect to get WSH script advice to be given
a console-level DOS method. They won't find
ATTRIB in their WSH CHM file. If you insist on
posting DOS methods in a VBS group then wouldn't
it make sense to at least explain the VBS method,
detail the DOS method, and point out why you think
the DOS method is better?
Quote:

> By the way, DOS? I thought DOS was a legacy operating system
> introduced some 30 years ago and only rarely used these days?
>
DOS. Yes.
http://en.wikipedia.org/wiki/List_of_DOS_commands
I gather that MS has somehow polished up the
DOS EXEs and re-released them as 32-bit, but
I don't see how that makes a difference. You're
talking about command line or console operation
using a DOS command.



My System SpecsSystem Spec
Old 08-09-2008   #8 (permalink)
Pegasus \(MVP\)


 
 

Re: Change File Attributes


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:ehDX9Ul%23IHA.3344@xxxxxx
Quote:

>
Quote:
Quote:

>> >> attrib.exe is the usual command for such tasks.
>> >>
>> > In DOS, yes. In VBScript there's the FileSystemObject...
>> > which provides access to folders as objects via GetFolder...
>> > Each folder object has a Files collection object... each of
>> > which has an Attributes property.
>>
>> I'm quite aware of that but since I'm lazy I prefer not to
>> re-invent the wheel. If I can do a job with a single-line command
>> then I won't write a ten-line VB Script file to do the same thing.
>>
>
> That's fine. It's just that this is a VBS group.
> It might be a bit confusing to newcomers who
> expect to get WSH script advice to be given
> a console-level DOS method. They won't find
> ATTRIB in their WSH CHM file. If you insist on
> posting DOS methods in a VBS group then wouldn't
> it make sense to at least explain the VBS method,
> detail the DOS method, and point out why you think
> the DOS method is better?
I never said that attrib.exe as a console command was better -
I merely said it was an easier solution to apply. I am quite
aware that this is a vbscript group but I notice that some
posters are blissfully unaware that some standard admin tasks
have a console command tailored for just this purpose. A little
while ago someone posted a question here about a recursive
copy task with some date restrictions. He ran into a brick wall
with his 60-odd line script. He was flabbergasted to read that
robocopy.exe could do it in a single line of code. This is why I
sometimes point out a console command alternative.
Quote:
Quote:

>> By the way, DOS? I thought DOS was a legacy operating system
>> introduced some 30 years ago and only rarely used these days?
>>
>
> DOS. Yes.
> http://en.wikipedia.org/wiki/List_of_DOS_commands
> I gather that MS has somehow polished up the
> DOS EXEs and re-released them as 32-bit, but
> I don't see how that makes a difference. You're
> talking about command line or console operation
> using a DOS command.
We both know that DOS is a operating system, same as Windows
or Linux. DOS is characterised by being a 16-bit OS, by its boot files
io.sys, msdos.sys, config.sys and autoexec.bat, all of which have no
place in the WinNT engine. DOS also has some fundamental commands
such as sys.com and fdisk.exe, neither of which have a place in the WinNT
family of OSs. The Windows command console shares the black screen
with DOS and quite a few commands but the majority of its .exe files will
not run on a DOS machine.

Calling the Command Console "DOS" is frequently causing confusion,
with some posters talking about fdisk or config.sys when dealing with
boot issues. Using the proper term "Command Console" would avoid this
confusion.

I admit, however, that even Microsoft engineers use the term DOS
at times when speaking about the command console. Old habits die hard . . .


My System SpecsSystem Spec
Old 08-09-2008   #9 (permalink)
Gary''s Student


 
 

Re: Change File Attributes

Hi Al:

Thank you for responding. If you right-click a file and select Properties,
at the bottom of the General tab is an area for Attributes. You can select
either Read-only or Hidden or both. I would like to programmatically select
Read-only for all the files in a folder. If the file has ben blocked, the
General tab has an unblock button that I would like to access
programmatically.

As you have correctly guessed, I am a Student; but this is nto a homework
assignment.
--
Gary''s Student - gsnu200799


"Al Dunbar" wrote:
Quote:

>
> "mayayana" <mayaXXyana@xxxxxx> wrote in message
> news:%234h22%23h%23IHA.872@xxxxxx
Quote:

> >
Quote:

> >> I have a set of files in a folder and want to modify their properties.
> >> In
> >> one folder I have a set of .asx files that I would like to un-block
> > en-mass.
Quote:

> >> In another folder I have a set of .url files that I would like to protect
> >> en-mass.
> >>
> >
> > So what's the question? Do you expect someone
> > to just write the whole script for you? If not then
> > you need to be more specific about which part has
> > you stumped.
>
> What has me stumped is what he means my "un-blocking" and "protecting". This
> could be anything from simple changes to the "R" attribute to something more
> detailed using NTFS permissions. Of course if you are "protecting" a file
> with NTFS permissions, what are you protecting it from, modification?
> deletion? being seen at all?
>
> What doesn't have me stumped is the reason behind the question posed by
> someone signing himself as "Gary's Student" - could this possibly be a
> homework question?
>
> /Al
>
>
>
My System SpecsSystem Spec
Old 08-10-2008   #10 (permalink)
mayayana


 
 

Re: Change File Attributes

> DOS .... have no
Quote:

> place in the WinNT engine.
>
Speak for yourself. I'm writing this on Win98.
Quote:

> Calling the Command Console "DOS" is frequently causing confusion,
> with some posters talking about fdisk or config.sys when dealing with
> boot issues. Using the proper term "Command Console" would avoid this
> confusion.
>
> I admit, however, that even Microsoft engineers use the term DOS
> at times when speaking about the command console. Old habits die hard . .
..
Quote:

>
If I boot to Win98 and open a "console" window it's
an MS-DOS window. I can also boot to DOS, where I
can run an ATTRIB command. (And if I happen to be
dual-booting with XP on a FAT32 partition I can also
use that DOS ATTRIB command on my XP files.)

If I open a "console"
window in XP I can also run an ATTRIB command. The
command is the same. The method and window are
basically the same. It seems to me that what you
like to call "command console" is, in this case, basically
32-bit DOS emulation. I call it DOS because you're using
DOS commands and you're using them in DOS fashion:
in a text-only interface. So if it looks like DOS, acts like
DOS and is used like DOS then I call it DOS, just as I
would call Power Shell "Power Shell", or call VBS "VBScript"
and not "GUI Control Tool".

Though I might sometimes refer to VBScript as "the
scripting tool created to replace the outdated, text-only
DOS tools when PCs began to have modern amenities like
mice and a graphical interface"



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
File attributes .NET General
change attributes in Vista? Vista installation & setup
File Attributes Vista General
file attributes PowerShell
Folder Attributes - Unable to change Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46