use*_*425 5 c# xml powershell dataset
我有以下powershell脚本扫描位置并将文件详细信息添加到xml文件,
Get-ChildItem -recurse c:\DATA | Select-Object * , @{Name="Kbytes";Expression={ "{0:N0}" -f ($_.Length / 1Kb) }},@{Name="Age";Expression={ (((Get-Date) - $_.CreationTime).Days) }} | Export-Clixml c:\DATA\Final.xml
Run Code Online (Sandbox Code Playgroud)
据我所知,这应该是.net框架中的一个对象,假设一个数据集?我想要做的是将此对象加载到ac#应用程序并将其用作数据集.
如何将对象加载到c#中的数据集中?
System.Management.Automation.dll
程序集的引用.Runspace
Runspace
Pipeline
使用该Import-CliXml
命令创建PowerShell 对象Pipeline
关上 Runspace
var rs = RunspaceFactory.CreateRunspace();
rs.Open();
var pl = rs.CreatePipeline(@"Import-CliXml c:\DATA\Final.xml;");
var result = pl.Invoke();
rs.Close();
Run Code Online (Sandbox Code Playgroud) 归档时间: |
|
查看次数: |
1984 次 |
最近记录: |