这里是东西哈克,似乎工作:
PS> new-object "Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime"
new-object : Constructor not found. Cannot find an appropriate constructor for type
Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime.
At line:1 char:1
+ new-object "Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,Con ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
PS> [Windows.System.UserProfile.LockScreen]::OriginalImageFile
AbsolutePath : C:/Windows/Web/Screen/img100.png
AbsoluteUri : file:///C:/Windows/Web/Screen/img100.png
LocalPath : C:\Windows\Web\Screen\img100.png
Authority :
HostNameType : Basic
IsDefaultPort : True
IsFile : True
IsLoopback : True
PathAndQuery : C:/Windows/Web/Screen/img100.png
...
注意,由于的LockScreen没有构造函数的第一次调用失败,但该呼叫做一些事情在WinRT的投影/元数据,例如,你现在可以打电话拉LockScreen类中的静态方法/属性。
免责声明:没有,我可以在这个新对象语法找到这样是完全可能的,微软可以改变它认为它本质上是一个“隐藏”的,可能没有完全开发功能的任何文档。
Hmmmm做。好问题。至少你需要使用PowerShell v3(无论如何都使用Win8默认)和.NET 4.5。 Scott Hanselman的这篇博文似乎表明它可能来自C#,所以PowerShell也应该可以这样做。 http://www.hanselman.com/blog/HowToCallWinRTAPIsInWindows8FromCDesktopApplicationsWinRTDiagram.aspx – Goyuix