There are multiple ways to do something in NSIS, while one of them is most efficient and one works best.
*To copy a file:
*CopyFiles /SILENT "Path\to\file.txt" "Path\to\new\folder"
*To move a file:
*CopyFiles /SILENT "Path\to\file.txt" "Path\to\new\folder"
Delete "Path\to\file.txt"(Use when moving between drives)
*Rename "Path\to\file.txt" "Path\to\new\folder\file.txt"(For quick moving)
*To Remove a folder:
*Delete "Folder\file.txt"
Delete "Folder\file.txt" and so on...
RMDIR "Folder"
or
RMDIR /r "Folder"
*To back up registry settings (requires Registry.nsh and StrRep.nsh headers):
*${registry::KeyExists} "HKEY_CURRENT_USER\Software\ExampleBackupByExamplePortable" $R0
StrCmp $R0 "0" RestoreSettings
${registry::KeyExists} "HKEY_CURRENT_USER\Software\Example" $R0
StrCmp $R0 "-1" RestoreSettings
${registry::MoveKey} "HKEY_CURRENT_USER\Software\Example" "HKEY_CURRENT_USER\Software\ExampleBackupByExamplePortable" $R0
Sleep 100
*To restore portable registry settings (requires Registry.nsh and StrRep.nsh headers):
*RestoreSettings:
IfFileExists "$SETTINGSDIRECTORY\Example.reg" "" LaunchNow
;RestoreTheKey:
IfFileExists "$WINDIR\system32\reg.exe" "" RestoreTheKey9x
nsExec::ExecToStack `"$WINDIR\system32\reg.exe" import "$SETTINGSDIRECTORY\Example.reg"`
Pop $R0
StrCmp $R0 '0' LaunchNow ;successfully restored key
RestoreTheKey9x:
${registry::RestoreKey} "$SETTINGSDIRECTORY\Example.reg" $R0
StrCmp $R0 '0' LaunchNow ;successfully restored key
StrCpy $FAILEDTORESTOREKEY "true"
*To save portable registry settings(requires Registry.nsh and StrRep.nsh headers):
*;DoneRunning:
StrCmp $FAILEDTORESTOREKEY "true" SetOriginalKeyBack
${registry::SaveKey} "HKEY_CURRENT_USER\Software\Example" "$SETTINGSDIRECTORY\Example.reg" "" $0
Sleep 100
*To restore original registry settings (requires Registry.nsh and StrRep.nsh headers):
*${registry::DeleteKey} "HKEY_CURRENT_USER\Software\Example" $R0
Sleep 100
${registry::KeyExists} "HKEY_CURRENT_USER\Software\ExampleBackupByExamplePortable" $R0
StrCmp $R0 "-1" TheEnd
${registry::MoveKey} "HKEY_CURRENT_USER\Software\ExampleBackupByExamplePortable" "HKEY_CURRENT_USER\Example" $R0
Sleep 100
*To display a splash screen (Requires newadvsplash.dll plugin and StrRep.nsh header):
*StrCmp $DISABLESPLASHSCREEN "true" GetPassedParameters
;=== Show the splash screen before processing the files
InitPluginsDir
File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
newadvsplash::show /NOUNLOAD 1500 200 0 -1 /L $PLUGINSDIR\splash.jpg
FIXME