1

Does Windows offer a way to open the file/directory properties dialog through command line?

I found various rundll32.dll commands, but none of them offer this functionality. What would be the

enter image description here

2 Answers2

1

There is a utility called wmic in windows

wmic datafile where Name="F:\\abc.txt" get Description,Name,FileType

Hope it helps, Thnx in advance if not pls do comment below...

0

Indeed you can utilize Powershell for this. Powershell is able to create COM objects, which some Windows APIs are implemented as, in particular the Windows shell. The Powershell command would be something like this:

$shell = New-Object -COMObject Shell.Application
$shell.NameSpace($AbsolutePathToContainingFolder).ParseName($PathToFileInFolder).InvokeVerb("Properties")

Explaining the above:

  1. The Shell.Application object exposes Windows shell methods you need here, it's an object of a COM class
  2. $shell.NameSpace is the method that gets you a "namespace" API object corresponding to the folder containing the file, to use for further calls
  3. $AbsolutePathToContainingFolder denotes the full path to the folder containing the file you want to invoke the dialog on
  4. ParseName is required to obtain a FolderItem object for the file
  5. $PathToFileInFolder is [relative] path to the file in question
  6. InvokeVerb is the method that through invoking a well, verb, opens a the Properties dialog

Documentation of all the methods is available to you navigating through the Shell object documentation linked above.