安装日期和时间应用程序 [英] get date and time application installed
本文介绍了安装日期和时间应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我!!!
如何在Progreams和功能的Windows 7中安装像Installon colume一样的日期和时间应用程序?
解决方案
在这里查看: http://include.wutils.com/ wmi / ROOT%5Ccimv2 / CIM_Product / Win32_Product / cs-samples.html [ ^ ]
[更新:生成代码]
< pre lang =c#> // WMI查询列出root \ CYIM2:Win32_Product类的所有属性和值。
// 此C#代码是使用WMI代码生成器7.03版生成的
// http://www.robvanderwou de.com/wmigen.php
使用系统;
使用 System.Linq;
使用 System.Management;
命名空间 WMIGen
{
public class Win32_Product_Query
{
public static int Main( string [] args)
{
尝试
{
字符串 computer = string 跨度> .Empty;
if (args.Count()== 1 )
{
computer = @ \\ + args [ 0 ] + @ \;
}
ManagementObjectSearcher searcher = new ManagementObjectSearcher(计算机+ @ root \CIMV2, SELECT * FROM Win32_Product 跨度>);
ManagementObjectCollection colItems = searcher.Get();
Console.WriteLine( {0} instance {1}, colItems.Count,(colItems.Count == 1 ? String .Empty: s));
Console.WriteLine();
foreach (ManagementObject queryObj in colItems)
{
Console.WriteLine( AssignmentType:{0},queryObj [ AssignmentType]);
Console.WriteLine( 标题:{0},queryObj [ 标题]);
Console.WriteLine( 描述:{0},queryObj [ Description]);
Console.WriteLine( HelpLink:{0},queryObj [ HelpLink]);
Console.WriteLine( HelpTelephone:{0},queryObj [ HelpTelephone]);
Console.WriteLine( IdentifyingNumber:{0},queryObj [ IdentifyingNumber]);
Console.WriteLine( InstallDate:{0},queryObj [< span class =code-string> InstallDate]);
Console.WriteLine( InstallDate2:{0},queryObj [ InstallDate2]);
Console.WriteLine( InstallLocation:{0},queryObj [ INSTALLLOCATION跨度>]);
Console.WriteLine( InstallSource:{0},queryObj [ InstallSource]);
Console.WriteLine( InstallState:{0},queryObj [ InstallState]);
Console.WriteLine( 语言:{0},queryObj [ 语言]);
Console.WriteLine( LocalPackage:{0},queryObj [ LocalPackage]);
Console.WriteLine( 名称:{0},queryObj [ 名称]);
Console.WriteLine( PackageCache:{0},queryObj [ PackageCache]);
Console.WriteLine( PackageCode:{0},queryObj [ PackageCode]);
Console.WriteLine( PackageName:{0},queryObj [ PackageName]);
Console.WriteLine( ProductID:{0},queryObj [ ProductID]);
Console.WriteLine( RegCompany:{0},queryObj [ RegCompany]);
Console.WriteLine( RegOwner:{0},queryObj [ RegOwner]);
Console.WriteLine( SKUNumber:{0},queryObj [ SKUNumber]);
Console.WriteLine( Transforms:{0},queryObj [ Transforms]);
Console.WriteLine( URLInfoAbout:{0},queryObj [ URLInfoAbout]);
Console.WriteLine( URLUpdateInfo:{0},queryObj [ URLUpdateInfo]);
Console.WriteLine( 供应商:{0},queryObj [ 供应商]);
Console.WriteLine( Version:{0},queryObj [ Version]);
Console.WriteLine( WordCount:{0},queryObj [ WordCount]);
Console.WriteLine();
}
return 0 ;
}
catch (例外e)
{
Console.Error.WriteLine( 查询WMI时发生错误:{0},e.Message);
return 1 ;
}
}
}
}
见这里:http://stackoverflow.com/questions/414653/get-install-date-from-managed-code [< a href =http://stackoverflow.com/questions/414653/get-install-date-from-managed-codetarget =_ blanktitle =New Window> ^ ]
please help me!!!
how to get date and time application installed like Installon colume in Progreams and Features ''s windows 7?
解决方案
Look here: http://include.wutils.com/wmi/ROOT%5Ccimv2/CIM_Product/Win32_Product/cs-samples.html[^]
[update: generated code]
// WMI query to list all properties and values of the root\CIMV2:Win32_Product class. // This C# code was generated using the WMI Code Generator, Version 7.03 // http://www.robvanderwoude.com/wmigen.php using System; using System.Linq; using System.Management; namespace WMIGen { public class Win32_Product_Query { public static int Main(string[] args) { try { string computer = string.Empty; if (args.Count() == 1) { computer = @"\\" + args[0] + @"\"; } ManagementObjectSearcher searcher = new ManagementObjectSearcher(computer + @"root\CIMV2", "SELECT * FROM Win32_Product"); ManagementObjectCollection colItems = searcher.Get( ); Console.WriteLine( "{0} instance{1}", colItems.Count, ( colItems.Count == 1 ? String.Empty : "s" ) ); Console.WriteLine( ); foreach ( ManagementObject queryObj in colItems ) { Console.WriteLine("AssignmentType : {0}", queryObj["AssignmentType"]); Console.WriteLine("Caption : {0}", queryObj["Caption"]); Console.WriteLine("Description : {0}", queryObj["Description"]); Console.WriteLine("HelpLink : {0}", queryObj["HelpLink"]); Console.WriteLine("HelpTelephone : {0}", queryObj["HelpTelephone"]); Console.WriteLine("IdentifyingNumber : {0}", queryObj["IdentifyingNumber"]); Console.WriteLine("InstallDate : {0}", queryObj["InstallDate"]); Console.WriteLine("InstallDate2 : {0}", queryObj["InstallDate2"]); Console.WriteLine("InstallLocation : {0}", queryObj["InstallLocation"]); Console.WriteLine("InstallSource : {0}", queryObj["InstallSource"]); Console.WriteLine("InstallState : {0}", queryObj["InstallState"]); Console.WriteLine("Language : {0}", queryObj["Language"]); Console.WriteLine("LocalPackage : {0}", queryObj["LocalPackage"]); Console.WriteLine("Name : {0}", queryObj["Name"]); Console.WriteLine("PackageCache : {0}", queryObj["PackageCache"]); Console.WriteLine("PackageCode : {0}", queryObj["PackageCode"]); Console.WriteLine("PackageName : {0}", queryObj["PackageName"]); Console.WriteLine("ProductID : {0}", queryObj["ProductID"]); Console.WriteLine("RegCompany : {0}", queryObj["RegCompany"]); Console.WriteLine("RegOwner : {0}", queryObj["RegOwner"]); Console.WriteLine("SKUNumber : {0}", queryObj["SKUNumber"]); Console.WriteLine("Transforms : {0}", queryObj["Transforms"]); Console.WriteLine("URLInfoAbout : {0}", queryObj["URLInfoAbout"]); Console.WriteLine("URLUpdateInfo : {0}", queryObj["URLUpdateInfo"]); Console.WriteLine("Vendor : {0}", queryObj["Vendor"]); Console.WriteLine("Version : {0}", queryObj["Version"]); Console.WriteLine("WordCount : {0}", queryObj["WordCount"]); Console.WriteLine(); } return 0; } catch (Exception e) { Console.Error.WriteLine("An error occurred while querying WMI: {0}", e.Message); return 1; } } } }
See here: http://stackoverflow.com/questions/414653/get-install-date-from-managed-code[^]
这篇关于安装日期和时间应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文