기본 콘텐츠로 건너뛰기

Constants

4.2.3 Constants
Constants can also be used in the InstallDirattribute.
Note that some of the new constants will not work on every OS.
For example, \$CDBURN_AREA will only work on Windows XP and above.
If it's used on Windows 98, it'll be empty. Unless mentioned otherwise, a constant should be available on every OS.
\$PROGRAMFILES, \$PROGRAMFILES32, \$PROGRAMFILES64
The program files directory (usually C:\Program Filesbut detected at runtime).
On Windows x64, \$PROGRAMFILES and \$PROGRAMFILES32 point to C:\Program Files (x86) while \$PROGRAMFILES64 points to C:\Program Files.
Use \$PROGRAMFILES64 when installing x64 applications.
\$COMMONFILES, \$COMMONFILES32, \$COMMONFILES64
The common files directory.
This is a directory for components that are shared across applications (usually C:\Program Files\Common Filesbut detected at runtime).
On Windows x64, \$COMMONFILES and \$COMMONFILES32 point to C:\Program Files (x86)\Common Files while \$COMMONFILES64 points to C:\Program Files\Common Files.
Use \$COMMONFILES64 when installing x64 applications.
\$DESKTOP
The Windows desktop directory (usually C:\Windows\Desktopbut detected at runtime).
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$EXEDIR
The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea).
$EXEFILE
The base name of the installer executable.
$EXEPATH
The full path of the installer executable.
${NSISDIR}
A symbol that contains the path where NSIS is installed.
Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs etc.
When compiled with support for keeping makensis and the data in the same place (the default on Windows),
it is in the same place as makensis, on other platforms it is set at compile time (See the INSTALL file for info).
In both instances you can modify it at runtime by setting the NSISDIR environment variable. See section 3.1.3for more info.
$WINDIR
The Windows directory (usually C:\Windowsor C:\WinNTbut detected at runtime).
$SYSDIR
The Windows system directory (usually C:\Windows\Systemor C:\WinNT\System32but detected at runtime).
$TEMP
The system temporary directory (usually C:\Windows\Tempbut detected at runtime).
$STARTMENU
The start menu folder (useful in adding start menu items using CreateShortCut).
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$SMPROGRAMS
The start menu programs folder (use this whenever you want \$STARTMENU\Programs).
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$SMSTARTUP
The start menu programs / startup folder.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$QUICKLAUNCH
The quick launch folder for IE4 active desktop and above.
if quick launch is not available, simply returns the same as \$TEMP.
$DOCUMENTS
The documents directory.
A typical path for the current user is C:\Documents and Settings\Foo\My Documents.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 not installed.
$SENDTO
The directory that contains Send To menu shortcut items.
$RECENT
The directory that contains shortcuts to the user's recently used documents.
$FAVORITES
The directory that contains shortcuts to the user's favorite websites, documents, etc.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 not installed.
$MUSIC
The user's music files directory.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is available on Windows XP, ME and above.
$PICTURES
The user's picture files directory.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is available on Windows 2000, XP, ME and above.
$VIDEOS
The user's video files directory.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is available on Windows XP, ME and above.
$NETHOOD
The directory that contains link objects that may exist in the My Network Places/Network Neighborhood folder.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$FONTS
The system's fonts directory.
$TEMPLATES
The document templates directory.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$APPDATA
The application data directory.
Detection of the current user path requires Internet Explorer 4 and above.
Detection of the all users path requires Internet Explorer 5 and above. The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting.
The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$LOCALAPPDATA
The local (nonroaming) application data directory.
This constant is available on Windows 2000 and above.
$PRINTHOOD
The directory that contains link objects that may exist in the Printers folder.
This constant is not available on Windows 95 and Windows 98.
$INTERNET_CACHE
Internet Explorer's temporary internet files directory.
This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$COOKIES
Internet Explorer's cookies directory. This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$HISTORY
Internet Explorer's history directory.
This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$PROFILE
The user's profile directory. A typical path is C:\Documents and Settings\Foo.
This constant is available on Windows 2000 and above.
$ADMINTOOLS
A directory where administrative tools are kept.
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
This constant is available on Windows 2000, ME and above.
$RESOURCES
The resources directory that stores themes and other Windows resources (usually C:\Windows\Resourcesbut detected at runtime).
This constant is available on Windows XP and above.
$RESOURCES_LOCALIZED
The localized resources directory that stores themes and other Windows resources (usually C:\Windows\Resources\1033but detected at runtime).
This constant is available on Windows XP and above.
$CDBURN_AREA
A directory where files awaiting to be burned to CD are stored.
This constant is available on Windows XP and above.
$HWNDPARENT
The decimal HWND of the parent window.
$PLUGINSDIR
The path to a temporary folder created upon the first usage of a plug-in or a call to InitPluginsDir.
This folder is automatically deleted when the installer exits.
This makes this folder the ideal folder to hold INI files for InstallOptions, bitmaps for the splash plug-in, or any other file that a plug-in needs to work.

댓글

이 블로그의 인기 게시물

80040154 오류로 인해 CLSID가 {xxxx-...}인 구성 요소의 COM 클래스 팩터리를 검색하지 못했습니다.

원문보기 .NET 으로 만든 응용프로그램에서 com 객체를 호출한 경우 Windows7 64bit 에서 제목과 같은 에러가 발생했다. Win32 COM 과 .NET 프로그램간의 호환성 때문에 생긴 문제였다. 원인은 .NET 실행시 JIT 컴파일러에 의해 최적화된 기계어로 변환되기 때문.. Win32 COM은 컴파일시.. Win32 COM에 맞춰 빌드 속성에서 하위버전으로 맞춰 컴파일을 다시하는 방법도 있지만 메인 프로젝트가 .NET이라면 참조되는 모든 프로젝트를 다 바꿔야할 노릇.. 또 다른 방법은 COM+를 이용하여 독립적으로 만드는 것이다. 분리시키는 방법은 아래 주소해서 확인할 수 있다. http://support.microsoft.com/kb/281335 나의 경우는 Win32 COM DLL을 64비트 .NET 프로그램에서 참조하니 COM 객체를 제대로 호출하지 못하였습니다. 그래서 .NET 프로그램의 Target Machine을 x86으로 설정하니 제대로 COM 객체를 호출하였습니다.

[Pyinstaller] 실행 파일 관리자 권한 획득하기

고객사에서 일부 사용자에게서 프로그램 오류가 발생한다며 아래와 같이 에러 캡처를 보내왔습니다. 프로그램에서 로그를 남기기 위해 로그 파일을 생성하는데 권한의 문제로 로그 파일을 생성하지 못해 프로그램 오류가 발생한 것 같습니다. 처음에는 Python 코드에서 관리자 권한을 요청하는 코드를 넣으려고 했는데, 실제로 Stackoverflow를 찾아보면 이런 내용이 나옵니다. 프로그램이 관리자 권한으로 실행되지 않았다면 관리자 권한으로 다시 프로그램을 실행시키는 코드입니다. import os import sys import win32com.shell.shell as shell ASADMIN = 'asadmin' if sys.argv[-1] != ASADMIN: script = os.path.abspath(sys.argv[0]) params = ' '.join([script] + sys.argv[1:] + [ASADMIN]) shell.ShellExecuteEx(lpVerb='runas', lpFile=sys.executable, lpParameters=params) sys.exit(0) 하지만 개인적으로 이런 방식은 마음에 들지 않았고 조금 더 찾아보니 Pyinstaller로 exe 파일을 만들 때 옵션을 설정하여 관리자 권한을 요청하도록 할 수 있다고 합니다. --uac-admin을 옵션에 추가하면 프로그램 실행 시 관리자 권한을 요청할 수 있습니다. pyinstaller.exe --uac-admin sample.py 하지만 안타깝게도 이 방식은 원하는 대로 동작하지 않았습니다. 마지막으로 manifest 파일을 이용하여 시도해보았습니다. spec 파일을 이용하여 pyinstaller로 빌드하면 <실행 파일 이름>.manifest 라는 파일이 생성됩니다. 파일에서 아랫부분을 찾아볼 수 있습니다. <security> <re

초간단 프로그램 락 걸기

프로그램에 락을 걸 일이 생겨났다. 하드웨어 락을 걸면 쉬울텐데 그 정도는 아니고 프로그램의 실행 날짜를 제한 해 달라고 한다. 그래서 파일(license.lic)을 가지고 락을 걸리고 결정을 했다. 요구 사항은 아래와 같다. 1. license.lic 파일이 없으면 프로그램을 실행 할수 없게 한다. 2. 지정한 날짜를 넘어서는 프로그램을 실행 할수 없게 한다. 3. 사용자가 시스템 날짜를 되돌렸을때 인식하여 프로그램을 실행 할수 없게 한다. 음.... 1.번 문제는 사용자가 프로그램을 실행하기 위해서 license.lic 파일을 받아야만 한다. license.lic 파일에는 최근 실행 날짜/종료날짜 이런식으로 적도록 한다.(물론 내용은 암호화 한다.) 최근 실행날짜는 프로그램이 실행때마다 업데이트 하도록 하고 시스템 날짜와 비교하여 시스템 날짜가 최근 실행 날짜보다 이전의 날짜면 시스템 날짜를 되돌렸다고 인식하도록 한다.(3.번 문제 해결) 시스템 날짜와 종료 날짜를 비교하여 시스템 날짜가 종료 날짜를 넘으면 프로그램을 실행 할수 없도록 한다.(2.번 문제 해결)