开发者

Is there an environmental variable or equivalent for WinZip?

开发者 https://www.devze.com 2023-01-08 12:41 出处:网络
Is there an environmental variable or equivalent for WinZip32.exe I can use to find it\'s location path?

Is there an environmental variable or equivalent for WinZip32.exe I can use to find it's location path?

EDIT - This is 开发者_如何转开发an in house tool for a controlled system.

Thanks.


You could access the registry and use look up what the associated program is for .zip files. That would be better anyway since not everyone uses WinZip.


The installers usually store useful information under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall but the actual key it's not always easy to find and the information stored varies from installer to installer.

It looks like WinZip (at least 14.5) is using an MSI based installer so you'll need to find it's key (in my case {CD95F661-A5C4-44F5-A6AA-ECDD91C240BD}) then read the InstallLocation key (full path HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CD95F661-A5C4-44F5-A6AA-ECDD91C240BD}\InstallLocation).

P.S. If WinZip is too much trouble you can always go for one of it's many free alternatives that offer command line versions, like 7-Zip for instance, that you can install/copy in known location.


Is there an environmental variable or equivalent for WinZip32.exe I can use to find it's location path?

YOu probably can extract program location from registry. Most programs store their settings either in HKEY_LOCAL_MACHIN/Software/VendorName/ProgramName or HKEY_CURRENT_USER/Software/VendorName/ProgramName . Where VendorName is company's name and ProgramName is name of the program. Those settings MAY include installation path. And, of course, there is uninstall information somewhere in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall However, relying on either of them is not a good idea - settings format may change in next release, and some users (like me) tend to nuke extra values from registry even if they still have the program. So you can't guarantee that program is present if those values are set, and you can't guarantee that it isn't present if those values are missing.

The proper solution depends on what you're going to do with winzip.

If you want to extract *.zip files with your program, you have two options:

  1. Use some kind of library that handles zip files.
  2. Include compact *.zip-comptaible archiver (possibly command-line) with your program.

If you want to open files in winzip for the user, then proper way would be to open use whatever program is associated with *.zip on user's system instead of forcing user to use winzip. I believe that opening file using program (currently associated with that filetype) can be done with ShellExecute

0

精彩评论

暂无评论...
验证码 换一张
取 消