[英]How to check the space in the drive by taking the path from the Destination Folder When installing the software using NSIS
[英]Path in the Destination folder is appending to the old path instead of showing the new path using NSIS
當我安裝時,默認情況下,在目標文件夾中,它顯示路徑“C:\\Program Files (x86)\\DllTesting\\”(正如預期的那樣)。
然后我嘗試將路徑更改為“C:\\Program Files\\AppTest”
但是,一旦我選擇了上述路徑並單擊“確定”,從“瀏覽”中,它會顯示“C:\\Program Files\\AppTest\\DllTesting”而不是“C:\\Program Files\\AppTest”
在此處輸入圖像描述當我從下面的路徑中刪除“DllTesting”時,它會正確顯示新路徑而不附加到舊路徑。
安裝目錄 $PROGRAMFILES\\DllTesting
但是我不能從上面的路徑中刪除“DllTesting”,因為默認情況下我應該顯示路徑“C:\\Program Files (x86)\\DllTesting\\”
下面是我的代碼片段:
; DllTesting.nsi
;
;--------------------------------
!include LogicLib.nsh
Name "DllTesting"
OutFile "DllTesting.exe"
InstallDir $PROGRAMFILES\DllTesting
InstallDirRegKey HKLM "Software\NSIS_DllTesting" "Install_Dir"
RequestExecutionLevel admin
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "DllTesting (required)"
SetOutPath $INSTDIR
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_DllTesting "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DllTesting" "DisplayName" "NSIS DllTesting"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DllTesting" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DllTesting" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DllTesting" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
請幫助我如何更改瀏覽路徑而不附加到上一個路徑?
在文檔中閱讀 InstallDir,你會發現:
請注意,如果用戶選擇“瀏覽”,則將使用此字符串中最后一個 \\ 后面的部分,並且可能會在安裝時將其附加回字符串(要禁用此功能,請以
\\
結束目錄(這將需要整個參數用引號括起來)。
嘗試改變
InstallDir $PROGRAMFILES\DllTesting
到
InstallDir "$PROGRAMFILES\DllTesting\"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.