| 1. |
Solve : accessing properties from dos command line? |
|
Answer» 1. I need to FIGURE out how to access the properties tab from the command line. 1. I need to figure out how to access the properties tab from the command line.you can use vbscript: Code: [Select]Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace("C:\temp") For Each strFileName in objFolder.Items If strFileName = "myVideo.avi" Then For i = 0 to 34 WScript.Echo i, objFolder.GetDetailsOf(strFileName,i) Next Exit For End If Next save as myscript.vbs and on command prompt, type cscript /nologo myscript.vbs output: Code: [Select]Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. 0 myVideo.avi 1 418 KB 2 Video Clip 3 3/19/2002 5:26 AM 4 8/11/2007 11:06 AM 5 8/11/2007 11:06 AM 6 RA 7 Online 8 MYNEWNAME\Administrator 9 10 11 12 13 14 15 16 17 18 19 20 21 0:00:00 22 23 24 25 26 1024 x 768 27 1024 pixels 28 768 pixels 29 30 31 32 33 34 you can see that index 26-28 contains the video information Quote 2. A less important question, and possibly something better answered for python than for dos, but something else I'm trying to figure out: what's the best way to distinguish between directories and files in a folder? I'm looking for something like an "isDirectory()" kind of function. check out the Python docs for os.path module. Basically, to check if its a file, use os.path.isfile(), or directory use os.path.isdir() Thank you! This REPLY is ages late, but it took awhile before it was necessary for me to implement this code. Also, there's one change to make here, at least on my COMPUTER: "myVideo.avi" should be changed to "myVideo" - for whatever reason, you don't include the extension. This wasn't a problem for me (once I figured it out!) but may be a problem for others if they have multiple files with the same name but different extensions. On files with the same name it will pick the avi file though, I guess because it's earlier in the alphabet. |
|