I used the snake's code except a command line argument instead of a prompt.
You and BC are in the same camp: "All Hat and no Cattle."
Ironic. All you've done since your original post is purposely invent situations in which other peoples solutions break. For example by munging the batch file sidewinder provided. It works fine for me.
Obviously you failed to "convert" it to use a command-line argument, because it works fine here.
for a icon file I have:
D:\>side
Enter file name: D:\question.ico
Date Created: 09/08/2009
Date Accessed: 09/08/2009
Date Written: 09/08/2009
Fully Qualified Name: D:\question.ico
Drive Specification: D:
Path Specification: \
File Name: question
File Extension: .ico
Short Name: D:\question.ico
File Attributes: --a------
File Date/Time: 09/08/2009 05:39 PM
File Size: 15086
D:\>
It failed when I tried to use it on files from another drive:
Probably easily fixed with a PushD of some form, since it works from that directory:
D:\>side C:\windows\syswow64\shell32.dll
Enter file name: C:\windows\syswow64\shell32.dll
Date Created: 07/30/2009
Date Accessed: 07/30/2009
Date Written: 04/10/2009
Fully Qualified Name: C:\Windows\SysWOW64\shell32.dll
Drive Specification: C:
Path Specification: \Windows\SysWOW64\
File Name: shell32
File Extension: .dll
Short Name: C:\Windows\SysWOW64\shell32.dll
File Attributes: --a------
File Date/Time: 04/10/2009 11:28 PM
File Size: 11584000
In either case perhaps before making alterations to a batch file Billrich should test it as provided, rather then making changes and proclaiming epic failure even when it's fully possible the changes caused the problem, as I believe to be the case here.
Seems to work fine. Of course I didn't mess about with the innards like a inept surgery intern. I believe the logic at this point speaks for itself for everybody but
SpectateSwamp Billrich, who will continue on with analogies that bring back his fond memories of the ranch, and yet have no bearing to the context at all.
In other news, I also converted (somewhat more successfully then the batch code... which I didn't mess with at all) the VBS file to access only a single file specified as an argument.
Set objFS=CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strFile= wscript.Arguments(0)
Set objFile = objFS.GetFile(strFile)
name=Replace(ObjFile.Path,"\","\\")
s="Select * from CIM_Datafile Where name = """ & name & """"
Set colFiles = objWMIService.ExecQuery(s)
For Each objFile in colFiles
Wscript.Echo "Access mask: " & objFile.AccessMask
Wscript.Echo "Archive: " & objFile.Archive
Wscript.Echo "Compressed: " & objFile.Compressed
Wscript.Echo "Compression method: " & objFile.CompressionMethod
Wscript.Echo "Creation date: " & objFile.CreationDate
Wscript.Echo "Computer system name: " & objFile.CSName
Wscript.Echo "Drive: " & objFile.Drive
Wscript.Echo "8.3 file name: " & objFile.EightDotThreeFileName
Wscript.Echo "Encrypted: " & objFile.Encrypted
Wscript.Echo "Encryption method: " & objFile.EncryptionMethod
Wscript.Echo "Extension: " & objFile.Extension
Wscript.Echo "File name: " & objFile.FileName
Wscript.Echo "File size: " & objFile.FileSize
Wscript.Echo "File type: " & objFile.FileType
Wscript.Echo "File system name: " & objFile.FSName
Wscript.Echo "Hidden: " & objFile.Hidden
Wscript.Echo "Last accessed: " & objFile.LastAccessed
Wscript.Echo "Last modified: " & objFile.LastModified
Wscript.Echo "Manufacturer: " & objFile.Manufacturer
Wscript.Echo "Name: " & objFile.Name
Wscript.Echo "Path: " & objFile.Path
Wscript.Echo "Readable: " & objFile.Readable
Wscript.Echo "System: " & objFile.System
Wscript.Echo "Version: " & objFile.Version
Wscript.Echo "Writeable: " & objFile.Writeable
WScript.Echo "Install Date: " & objFile.InstallDate
Wscript.Echo "-----------------------------------------------------------------"
Next
This can be accessed in a batch file:
cscript fileattribs.vbs D:\testads2.txt
D:\>fileattribs D:\testads2.txt
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Access mask:
Archive: True
Compressed: False
Compression method:
Creation date: 20090803234730.934563-420
Computer system name: TERATRON
Drive: d:
8.3 file name: d:\testads2.txt
Encrypted: False
Encryption method:
Extension: txt
File name: testads2
File size: 287
File type: Text Document
File system name: NTFS
Hidden: False
Last accessed: 20090803234730.934563-420
Last modified: 20090303190457.875000-480
Manufacturer:
Name: d:\testads2.txt
Path: \
Readable: True
System: False
Version:
Writeable: True
Install Date: 20090803234730.934563-420
-----------------------------------------------------------------