【发布时间】:2012-11-14 09:58:10
【问题描述】:
我是 C# 新手,我无法解决这个错误,谁能帮帮我?此脚本用于删除不需要的快捷方式,如果尚未安装,则安装新程序。
using System;
using WindowsInstaller;
string startMenuDir = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
string shortcutold = Path.Combine(startMenuDir, @"Ohal\TV AMP (Windows XP Mode).lnk");
if (File.Exists(shortcutold))
File.Delete(shortcutold);
string startMenuDir = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
string shortcut = Path.Combine(startMenuDir, @"Ohal\TV AMP.lnk");
if (File.Exists(shortcut))
{
Console.WriteLine("Already installed...");
}
else
{
Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer");
Installer installer = (Installer)Activator.CreateInstance(type);
installer.InstallProduct(@"Y:\LibSetup\TVAMP313\TVAmp v3.13.msi");
}
【问题讨论】:
-
拜托,你有什么烦恼。当问题未定义时,我们无法为您提供帮助
标签: c#