PC Review


Reply
Thread Tools Rate Thread

WMI script terminate at longer *name*.

 
 
=?Utf-8?B?Q3VyaW91c01l?=
Guest
Posts: n/a
 
      6th Oct 2005
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.
 
Reply With Quote
 
 
 
 
Scott McNairy \(MVP\)
Guest
Posts: n/a
 
      14th Oct 2005
Can you post the code?

--
Scott McNairy
Microsoft MVP - Windows Server Management Infrastructure


"CuriousMe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q3VyaW91c01l?=
Guest
Posts: n/a
 
      15th Oct 2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create and terminate process using wmi abhi Windows XP WMI 0 18th Dec 2006 09:04 PM
Tool/script to terminate all/selected tasks? David Winter Windows XP General 11 23rd Jun 2004 12:09 PM
WMI Win32_Process Terminate Method with Listbox Peter Neuburger via .NET 247 Microsoft VB .NET 3 14th May 2004 03:59 PM
Re: WMI Error : Unable to connect to wmi service "root\cimv2" wil_riker01 Windows XP Networking 0 11th Feb 2004 10:55 PM
Terminate process in wmi with vb.net Keith Grefski Microsoft VB .NET 3 11th Jan 2004 03:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:22 PM.