2008年11月21日 ..:: Forum ::.. 注册  登录
 导航

 打印   
 搜索


 打印   
 友情链接

 打印   
 论坛
搜索论坛首页
  聚合  IT  Dot Net  Making a folder...
 Making a folder compressed in .Net
 
AD Robot
 2007/9/6 0:00:00
用户离线FengLiN
124个帖子
www.huachaojune.com
第四




Making a folder compressed in .Net

You can use the System.Management and the WMI class win32_directory to
compress a folder.

string dirName = "c:\\\\someFolder";
string objPath = "Win32_Directory.Name=" + "\"" + dirName + "\"";
using (ManagementObject dir= new ManagementObject(objPath))
{
ManagementBaseObject outParams = dir.InvokeMethod("Compress", null,
null);
uint ret = (uint)(outParams.Properties["ReturnValue"].Value);
if(ret == 0)
Console.WriteLine("Success");
else Console.WriteLine("Failed with error code: {0}", ret);
}


看贴是缘分, 顶贴是友情.
  聚合  IT  Dot Net  Making a folder...

搜索搜索  论坛首页论坛首页    打印   
Copyright 2008 by 三片叶   服务条款  隐私声明