這裏是東西哈克,似乎工作:
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