We help IT Professionals succeed at work.
Get Started

Windows 7 Run VBS script to hide file and folders as administrator

DC10 asked
Last Modified: 2013-12-04
Hi there, i need some help, i am working on a project, where we need to restrict some access to file and folders, that is default install on Windows 7.

So fare i know that the vbs has to run as administrator on the local PC, i have found a old sribt that will handle the job of hiding the files

To hide files simply use this code
Dim FS, F
Set FS = CreateObject("Scripting.FileSystemObject")
Set F = FS.GetFile(%FILEPATH%) 'Replace %FILEPATH% with the files path
F.Attributes = -1 ' -1 Makes it a system file so its hidden from windows explorer(works for me on xp)

But now i need it to run as administrator, because windows 7 dont give access to normal user to change the path.

Anyone know how to handle this ???
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE