Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBS script hides only content of the folder but not the folder itself

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,34871
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBS script hides only content of the folder but not the folder itself
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBS script hides only content of the folder but not the... - 5/25/2006 4:57:56 AM   
  xaviorinc

 

Posts: 25
Score: 0
Joined: 4/24/2006
Status: offline
i have written the following script to  hide the "Lexmark" folder in c:\documents and settings\all users\start menu\programs\lexmark

On Error Resume Next
Set WSHShell = WScript.CreateObject("WScript.Shell")
strMe = "PostProcessing Script for Lexmark C522"
cmd = "cmd /c echo y| cacls " + chr(34) + "D:\Documents and Settings\All Users\Start Menu\Programs\Lexmark" + chr(34) + "  /p  administrators:f"
iRet = WSHShell.Run(cmd,0,True)
If (iRet=0) Then
  WSHShell.LogEvent 0,strMe+": Successful"
  WScript.Quit(0)
Else
  WSHShell.LogEvent 1,strMe+": Failed"
  WScript.Quit(1)
End If

-------
Script works and it will hide the content of the Lexmark folder but my question is how can i hide the Lexmark folder itself?  I do not want users to be able to see the folder itsels.

Thanks,

XaviorInc
 
 
Post #: 1
 
 RE: VBS script hides only content of the folder but not... - 5/26/2006 3:01:20 AM   
  Country73


Posts: 732
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Why don't you just use the Folder Object in vbscript?

Hidden  =  2

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(<path to Folder>)
   If f.attributes and 2 Then
       f.attributes = f.attributes - 2
       wscript.echo "Folder is now Visible."
   Else
       f.attributes = f.attributes + 2
       wscript.echo "Folder is now Hidden."
   End If

(in reply to xaviorinc)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBS script hides only content of the folder but not the folder itself Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts