Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:20:56+00:00 2026-05-30T07:20:56+00:00

Consider the following VBScript which, when run, lists all the files in the current

  • 0

Consider the following VBScript which, when run, lists all the files in the current directory and their properties:

Option Explicit
Dim oShell : Set oShell  = CreateObject("Shell.Application")
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oFolder : Set oFolder = oShell.Namespace(oFSO.GetParentFolderName(Wscript.ScriptFullName))
Dim oFile, iPos, sHeader(999), sVal
' Get a list of the property names
For iPos = 0 to 999
    sHeader(iPos) = oFolder.GetDetailsOf(oFolder.Items, iPos)
Next
' For each file in this folder, print the property name and the value
For Each oFile in oFolder.Items
    WScript.Echo "Looking at " & oFile.Name
    For iPos = 0 To 999
        sVal = oFolder.GetDetailsOf(oFolder.ParseName(oFile.Name), iPos)
        If sVal <> "" Then WScript.Echo sHeader(iPos) & " (" & iPos & "): " & sVal
    Next
Next

If I run this in a folder that contains only this file and with the Windows setting “Hide extensions for known file types” disabled, then I get the following (correct) output:

D:\defect>cscript //NOLOGO list_metadata.vbs
Looking at list_metadata.vbs
Name (0): list_metadata.vbs
Size (1): 740 bytes
Item type (2): VBScript Script File
Date modified (3): 19/02/2012 12:26
Date created (4): 23/02/2012 22:16
Date accessed (5): 23/02/2012 22:16
Attributes (6): A
Perceived type (9): Unspecified
Owner (10): HOME\Richard
Kind (11): Program
Rating (19): Unrated
Computer (53): HOME (this computer)
Filename (155): list_metadata.vbs
Shared (173): No
Folder name (176): defect
Folder path (177): D:\defect
Folder (178): defect (D:)
Path (180): D:\defect\list_metadata.vbs
Type (182): VBScript Script File
Link status (188): Unresolved
Sharing status (269): Not shared

However if I run this again with “Hide extensions for known file types” enabled, then the value for each item is exactly the same as the property and the name of the file in the first line is missing the extension:

D:\defect>cscript //NOLOGO list_metadata.vbs
Looking at list_metadata
Name (0): Name
Size (1): Size
Item type (2): Item type
Date modified (3): Date modified
...lots deleted...
Frame width (285): Frame width
Total bitrate (286): Total bitrate
Masters Keywords (debug) (287): Masters Keywords (debug)
Masters Keywords (debug) (288): Masters Keywords (debug)

Does anyone know how I can modify this code so that it will work irrespective of whether or not this setting is applied in Windows?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:20:57+00:00Added an answer on May 30, 2026 at 7:20 am

    The Name property is the display name, not the file name. For the file name, use the Path property. But why are you extracting the name from the item, and then parsing the name back into an item? Why not just use the item directly?

    sVal = oFolder.GetDetailsOf(oFile, iPos) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following source files 1.cpp #include <iostream> using namespace std; struct X { X()
Consider following statement: C a, b; //C contains c1, c2 and c3 all integers
Consider following assumptions: I have Java 5.0 Web Application for which I'm considering to
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Consider following class class test { public: test(int x){ cout<< test \n; } };
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider following program: static void Main (string[] args) { int i; uint ui; i
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Please consider following code: 1. uint16 a = 0x0001; if(a < 0x0002) { //
Let's consider following, simplified example: We have 2 tabs withing <rich:tabPanel switchType=ajax> , each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.