环境:Window Server 2008
利用WinRAR解压缩文件
C# 代码:
RegistryKey theReg;
theReg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
此时会提示: 未将对象引用设置为对象的实例
解决办法:修改注册表,添加如下项:
HKEY_CLASSES_ROOT\Applications\WinRAR.exe\Shell\Open\Command
值为:"C:\Program Files (x86)\WinRAR\WinRAR.exe" "%1"