0

i am new to vbscript but i need to write a vbscript to create a new directory and set it attributes to hidden... now i want it shouldn't be shown when user searched for the hidden folders. can someone help how i can achieve this?? here is my small code

Dim objFSO, objFolder, strDiretory, 

strDirectory = "E:\logs"

Set objFSO = CreateObject("Scripting.FileSystemObject")




      Set objFolder = objFSO.CreateFolder(strDirectory)

   Set objFolder = objFSO.getFolder(strDirectory)
   objFolder.Attributes = 1
Cukoo
  • 1
  • 1
  • 2
    "Hidden" means it's not displayed by default. It doesn't mean it can't be found. Please take a step back and describe the actual problem you're trying to solve instead of what you perceive as the solution. Why shouldn't your users find that folder? – Ansgar Wiechers Mar 17 '13 at 21:26
  • i am just trying to learn about virus etc how can i use such options adopt by different viruses and trojans etc.... just to find some ways to track them down... – Cukoo Mar 19 '13 at 03:49

1 Answers1

0

If I remember right, hidden folders use an attribute of 2, not 1. Try the following code in place of yours for setting the attribute:

If objFolder.Attributes = objFolder.Attributes AND 2 Then
    objFolder.Attributes = objFolder.Attributes XOR 2
End If
BeanFlicker
  • 503
  • 1
  • 9
  • 23
  • yeah i used 2 i mistakenly posted 1 here.... but windows is showing thz hidden folder if search for hidden folders.... i wanna prevent it from being visible.... – Cukoo Mar 17 '13 at 19:26
  • 1
    I don't think you are able to do that if you explicitly tell Windows to do a search for hidden folders. – BeanFlicker Mar 17 '13 at 19:33
  • hmm yeah i was searching for it havent found anything yet.... there could be alternative way?? – Cukoo Mar 17 '13 at 19:37
  • 1
    http://stackoverflow.com/questions/500845/how-can-i-hide-a-directory-in-c-sharp-with-a-file-system-driver – BeanFlicker Mar 17 '13 at 19:50