Sign in to follow this  
Followers 0
roadrunner

file attribute want change to read only

3 posts in this topic

:) This must be really simple but I can't work it out

all Ii want to do is change the file attribute to read only but without hard coding the drive letter.

if I use the following code it works ok

FileSetAttrib("c:\program files\Webroot\Spy Sweeper\test.ini","+R")

If @error Then MsgBox(4096,"Error", "Problem setting attributes."

but use this and it want set it to read only

$varhome = @ProgramFilesDir

FileSetAttrib("$varhome &\Webroot\Spy Sweeper\test.ini","+R")

If @error Then MsgBox(4096,"Error", "Problem setting attributes."

any idears ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$varhome = @ProgramFilesDir

FileSetAttrib("$varhome &\Webroot\Spy Sweeper\test.ini","+R")

If @error Then MsgBox(4096,"Error", "Problem setting attributes."

$varhome = @ProgramFilesDir
FileSetAttrib($varhome & "\Webroot\Spy Sweeper\test.ini","+R")
If @error Then MsgBox(4096,"Error", "Problem setting attributes.")
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

thanks works a treat.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0