在用InstallShield制作安装包时,有时我们会在脚本中通过操作注册表,配置系统环境变量,比如在Path中追加,但卸载时如何清除追加的路径变量,一直有些模糊。
今天受网友启发,在InstallShield的帮助文档中找到了解决办法,代码如下:
STRING svSearchPath;
begin
// Set up the search path to pass as a parameter to PathSet.
svSearchPath = " C:\\DOS;C:\\WINDOWS;C:\\TEMP; " +
" D:\\Program Files\\Kevin Wan\\InstallShield; " +
" C:\\EXAMPLE\\SOURCE;D:\\WORK\\TEMP " ;
// Initialize the path buffer.
PathSet (svSearchPath);
// Display the initial search path.
// Delete D:\Program Files\Kevin Wan\InstallShield fro m the path buffer.
if (PathDelete ("Kevin Wan", PARTIAL) <0) then
MessageBox ("First call to PathDelete failed.", SEVERE);
endif;
// Get the search path from the path buffer; this call also releases
// the memory allocated for the path buffer.
PathGet (svSearchPath);
MessageBox(svSearchPath, INFORMATION);
end;