/build/static/layout/Breadcrumb_cap_w.png

VBScript for FInding folder path in system.

HI Team,

i have searched many ways in google but i didn't find my script.

 

Q: i am giveing one folder name like "ITNINJA" , we need search entire system (C, D , E .... drives) and found a folder respective name "ITNINJA" and we need to display "ITNINJA" folder path.

 

any please help me out

 

Thanks

appinstall


0 Comments   [ + ] Show comments

Answers (1)

Answer Summary:
http://blogs.technet.com/b/heyscriptingguy/archive/2008/04/17/how-can-i-find-folders-whose-name-fits-a-specified-pattern.aspx
Posted by: pjgeutjens 12 years ago
Red Belt
0
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True   
objRegEx.IgnoreCase = True
objRegEx.Pattern = "^bad_\d{8}"
strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery("Select * From Win32_Directory")
For Each objFolder in colFolders
    strFolder = objFolder.FileName
    Set colMatches = objRegEx.Execute(strFolder)
    If colMatches.Count > 0 Then
        Wscript.Echo objFolder.Name
    End If
Next

 

source: http://blogs.technet.com/b/heyscriptingguy/archive/2008/04/17/how-can-i-find-folders-whose-name-fits-a-specified-pattern.aspx

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Link

Related Links

Post

Related Posts

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ