WMI script terminate at longer *name*.

Discussion in 'Windows XP WMI' started by Guest, Oct 6, 2005.

  1. Guest

    Guest Guest

    i wrote a WMI script which list all files in 1 folder in 1 computer. My
    script will fail and stop if the folder's name has space or more than 8.3
    length.

    how do i correct this problem.?

    thank you.
     
    Guest, Oct 6, 2005
    #1
    1. Advertisements

  2. Can you post the code?

    --
    Scott McNairy
    Microsoft MVP - Windows Server Management Infrastructure


    "CuriousMe" <> wrote in message
    news:...
    >i wrote a WMI script which list all files in 1 folder in 1 computer. My
    > script will fail and stop if the folder's name has space or more than 8.3
    > length.
    >
    > how do i correct this problem.?
    >
    > thank you.
     
    Scott McNairy \(MVP\), Oct 14, 2005
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    here is the code. If you run it, it will stop running when it encounters
    longer name of a folder which has many spaces between words.

    i hope you can fix this problem. Thanks

    '============

    strDir = “c:\windowsâ€
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Call EnumAll(strDir)

    '====sub below=======
    sub EnumAll(fldr)

    Set FileList = objWMIService.ExecQuery("ASSOCIATORS OF
    {Win32_Directory.Name='"&fldr&"'}" & " Where ResultClass = CIM_DataFile ")

    For Each objFile In FileList

    wscript.echo("File: "&objFile.Name)

    Next

    set Folders=objWMIService.ExecQuery("ASSOCIATORS of
    {Win32_Directory.Name='"&fldr&"'}" & " where AssocClass = Win32_Subdirectory
    ResultRole = PartComponent")

    For each folder in Folders
    wscript.echo(vbcrlf&"Folder: "&folder.Name)
    Call EnumAll(folder.Name) 'recursion. Go through everything

    next

    end sub
     
    Guest, Oct 15, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David J Duryea

    VB WMI Script

    David J Duryea, Aug 26, 2004, in forum: Windows XP WMI
    Replies:
    0
    Views:
    1,081
    David J Duryea
    Aug 26, 2004
  2. Mark Jennings
    Replies:
    3
    Views:
    28,018
    SMSAdmin1
    Dec 29, 2004
  3. Joe
    Replies:
    0
    Views:
    2,465
  4. abhi

    create and terminate process using wmi

    abhi, Dec 18, 2006, in forum: Windows XP WMI
    Replies:
    0
    Views:
    840
  5. Georgebaker

    Run WMI within WMI

    Georgebaker, Aug 13, 2009, in forum: Windows XP WMI
    Replies:
    0
    Views:
    692
    Georgebaker
    Aug 13, 2009
Loading...

Share This Page