File object 8.3 properties in XP for pagefile.sys and hiberfil.sys 
Author Message
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys

Sorry if this is covered in some unknown (to me) corner.

It appears that the ShortName and ShortPath properties of the
FSO's File object are not supported for these two files in XP
(note: not tested in Home edition).

Any ideas ?  Known issue ?
I really dislike needing to add special case code ;-)

--
Roger Abell
MS MVP (Windows Platform), MCSE, MCDBA
Associate Expert - Windows XP ExpertZone
http://www.*-*-*.com/

'=====================================
' quick & dirty demo of XP (Pro) behavior
'   of file object 8.3 properties for
'   C:\hiberfil.sys C:\pagefile.sys
'=====================================
' choose either file, no other files have been
' found to demonstrate this lack of 8.3 support
strFile = "C:\pagefile.sys"
'strFile = "C:\hiberfil.sys"

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
   Set objFile = objFSO.GetFile(strFile)
   WScript.Echo objFile.Name, vbTab, objFile.Path
' uncomment either of the below to see the behavior
'   WScript.Echo vbTab, "ShortName : ", objFile.ShortName
'   WScript.Echo vbTab, "ShortPath : ", objFile.ShortPath
   Set objFile = nothing
Else
   WScript.Echo strFile, " not found; check the path spec."
End If

Set objFSO = Nothing



Thu, 16 Dec 2004 06:20:13 GMT  
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys
:: Sorry if this is covered in some unknown (to me) corner.
::
:: It appears that the ShortName and ShortPath properties of the
:: FSO's File object are not supported for these two files in XP
:: (note: not tested in Home edition).
::
:: Any ideas ?  Known issue ?
:: I really dislike needing to add special case code ;-)
::

If not a 'known issue' then at least a fact of life on Win2K as well ;-)...  If you search the scripting NGs at groups.google.com for pagefile.sys and ShortName you'll see that this has been posted before.

There are also other cases of files/folders (on at least Win9x) that don't have a DateCreated property.  In general, you don't have much choice but to code for exceptions...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Thu, 16 Dec 2004 06:59:55 GMT  
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys
Thanks for the info Michael.

I did test this on W2k adv server prior to posting
and found no issue.  Recursive enumeration of both
folders and files over entire XP boxen and W2k
servers, and just two problem-child file objects.

Blast the boundary cases.
This is particularly annoying as there seems no way
to test whether an attempt to access the property is
going to bomb out without bombing out due to the test.
Any ideas on how to make a routine that must scan for
all files/folders with shortname != longname resilient ?

Thanks again.
--
Roger Abell
MS MVP (Windows Platform), MCSE, MCDBA



:: Sorry if this is covered in some unknown (to me) corner.
::
:: It appears that the ShortName and ShortPath properties of the
:: FSO's File object are not supported for these two files in XP
:: (note: not tested in Home edition).
::
:: Any ideas ?  Known issue ?
:: I really dislike needing to add special case code ;-)
::

If not a 'known issue' then at least a fact of life on Win2K as well ;-)...
If you search the scripting NGs at groups.google.com for pagefile.sys and
ShortName you'll see that this has been posted before.

There are also other cases of files/folders (on at least Win9x) that don't
have a DateCreated property.  In general, you don't have much choice but to
code for exceptions...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Thu, 16 Dec 2004 08:04:21 GMT  
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys
I would implement error control and if it bombs, it bombs.  Not pretty in
theory, but once you start dealing with the fact of error codes (and also the
point that they do return useful information in most circumstances) it can be
valuable.

Check the results of this:

strFile = "C:\pagefile.sys"
'strFile = "C:\hiberfil.sys"
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
WScript.Echo objFile.Name
If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
Err.Clear
WScript.Echo objFile.Path
If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
Err.Clear
WScript.Echo objFile.ShortName
If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
Err.Clear
WScript.Echo objFile.ShortPath
If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
Err.Clear
Set objFile = nothing



Quote:
> Thanks for the info Michael.

> I did test this on W2k adv server prior to posting
> and found no issue.  Recursive enumeration of both
> folders and files over entire XP boxen and W2k
> servers, and just two problem-child file objects.

> Blast the boundary cases.
> This is particularly annoying as there seems no way
> to test whether an attempt to access the property is
> going to bomb out without bombing out due to the test.
> Any ideas on how to make a routine that must scan for
> all files/folders with shortname != longname resilient ?

> Thanks again.
> --
> Roger Abell
> MS MVP (Windows Platform), MCSE, MCDBA




> :: Sorry if this is covered in some unknown (to me) corner.
> ::
> :: It appears that the ShortName and ShortPath properties of the
> :: FSO's File object are not supported for these two files in XP
> :: (note: not tested in Home edition).
> ::
> :: Any ideas ?  Known issue ?
> :: I really dislike needing to add special case code ;-)
> ::

> If not a 'known issue' then at least a fact of life on Win2K as well ;-)...
> If you search the scripting NGs at groups.google.com for pagefile.sys and
> ShortName you'll see that this has been posted before.

> There are also other cases of files/folders (on at least Win9x) that don't
> have a DateCreated property.  In general, you don't have much choice but to
> code for exceptions...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US
> --



Thu, 16 Dec 2004 07:55:47 GMT  
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys
Thanks Alex.  As the routine will need to cover in the
10s of thousands of files and recurse their folders, I am
shooting for tight code (min cycles).

What I am finding curious is that WMI seems to have no
problem with the EightDotThreeFileName property of the
CIM_Datafile objects for these specific files (and does
display a values).  Of course, enumerating by WMI runs
like a dog, even if I do not try to impose an ordering as
obtained by recursing with the Scripting object.
That WMI can handle these seems to indicate the WMI
provider can compensate in a way the Scripting File object
cannot, and so perhaps it is not an issue with invalidity in
the underlying filesystem struct.  (?)

Given Michael's hint that I might expect to see this, I am
believing perhaps this should be done in C# in order to
structure it in try/catch handler.

--
Roger



Quote:
> I would implement error control and if it bombs, it bombs.  Not pretty in
> theory, but once you start dealing with the fact of error codes (and also
the
> point that they do return useful information in most circumstances) it can
be
> valuable.

> Check the results of this:

> strFile = "C:\pagefile.sys"
> 'strFile = "C:\hiberfil.sys"
> On Error Resume Next
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> WScript.Echo objFile.Name
> If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
> Err.Clear
> WScript.Echo objFile.Path
> If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
> Err.Clear
> WScript.Echo objFile.ShortName
> If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
> Err.Clear
> WScript.Echo objFile.ShortPath
> If Err.Number <> 0 Then WScript.Echo Err.Number, Err.Description
> Err.Clear
> Set objFile = nothing



> > Thanks for the info Michael.

> > I did test this on W2k adv server prior to posting
> > and found no issue.  Recursive enumeration of both
> > folders and files over entire XP boxen and W2k
> > servers, and just two problem-child file objects.

> > Blast the boundary cases.
> > This is particularly annoying as there seems no way
> > to test whether an attempt to access the property is
> > going to bomb out without bombing out due to the test.
> > Any ideas on how to make a routine that must scan for
> > all files/folders with shortname != longname resilient ?

> > Thanks again.
> > --
> > Roger Abell
> > MS MVP (Windows Platform), MCSE, MCDBA




> > :: Sorry if this is covered in some unknown (to me) corner.
> > ::
> > :: It appears that the ShortName and ShortPath properties of the
> > :: FSO's File object are not supported for these two files in XP
> > :: (note: not tested in Home edition).
> > ::
> > :: Any ideas ?  Known issue ?
> > :: I really dislike needing to add special case code ;-)
> > ::

> > If not a 'known issue' then at least a fact of life on Win2K as well
;-)...
> > If you search the scripting NGs at groups.google.com for pagefile.sys
and
> > ShortName you'll see that this has been posted before.

> > There are also other cases of files/folders (on at least Win9x) that
don't
> > have a DateCreated property.  In general, you don't have much choice but
to
> > code for exceptions...

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > Seattle WA US
> > --



Thu, 16 Dec 2004 15:33:56 GMT  
 File object 8.3 properties in XP for pagefile.sys and hiberfil.sys
If you decide to move this another language, then you might also
consider moving off the FileSystemObject as well. There is a pretty
significant speed difference between using FSO and the API.

See http://www.mvps.org/vb/code/FileInfo.zip by Karl Peterson for an
example of "how" and
http://www.mvps.org/vbnet/index.html?code/fileapi/fsoapicompare.htm
for details on the performance differences.

FSO is a wonderful tool but you're suggesting that with thousands of
files to measure on many machines, your chances of significant errors
and phone calls are equally large. A more optimal model is probably
more appropriate for you.

Greg Chapman
MS-MVP

http://www.mousetrax.com
MouseTrax Computing Solutions

On Sun, 30 Jun 2002 00:33:56 -0700, "Roger Abell [MVP]"

Quote:

>Thanks Alex.  As the routine will need to cover in the
>10s of thousands of files and recurse their folders, I am
>shooting for tight code (min cycles).

>What I am finding curious is that WMI seems to have no
>problem with the EightDotThreeFileName property of the
>CIM_Datafile objects for these specific files (and does
>display a values).  Of course, enumerating by WMI runs
>like a dog, even if I do not try to impose an ordering as
>obtained by recursing with the Scripting object.
>That WMI can handle these seems to indicate the WMI
>provider can compensate in a way the Scripting File object
>cannot, and so perhaps it is not an issue with invalidity in
>the underlying filesystem struct.  (?)

>Given Michael's hint that I might expect to see this, I am
>believing perhaps this should be done in C# in order to
>structure it in try/catch handler.



Fri, 17 Dec 2004 10:19:48 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sys/Start file on LaserWriter 630 Pro

2. Sys/Start Job

3. GS for Mac Classic + sys 6.0 ?

4. GS for Mac Classic + sys 6.0 ?

5. Elect. Document Sys Conference Seattle,Wa.

6. cscript and ANSI.SYS/ASCII

7. Summary of answers to posting: Sys 7, TrueType fonts, Latex

8. Sys 7, TrueType fonts, Latex

9. WSH - Only for sys admin or can it automate other tasks%

10. WinMe, Ansi.Sys, and Dos Color

11. Arguments pass short 8.3 filename, how pass LFN?

12. Apple Laserwriter Driver 8.3 is broken for Apple Laserwriters

 

 
Powered by phpBB® Forum Software