从Powershell打开文件系统对象属性窗口?


8

是否可以从Powershell打开文件或文件夹的属性对话框?

如果是这样,我将如何做?


1
我想你只需要添加Self与使用它的时候到Invoke $folder,不也$file。如果与一起使用$file,则会出现错误(“无法在空值表达式上调用方法”)。我使用的是第5版,也许有所不同。

Answers:


8
$o = new-object -com Shell.Application
$folder = $o.NameSpace("C:\path\to\file")
$file = $folder.ParseName("filename.txt")

# Folder:
$folder.Self.InvokeVerb("Properties")

# File:
$file.InvokeVerb("Properties")

进一步阅读

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.