Skip to content
⌘ NSIS Forum Archive

How can I execute .cmd or .bat file in end of the installation?

3 posts

galtech#

How can I execute .cmd or .bat file in end of the installation?

Hey,

I tried many options but nothing works for me ....
I really need help with this...

I'm installing my app at: $PROGRAMFILES\myapp
And my .cmd file location is at: $INSTDIR\reic\refresh.cmd

Really appreciate if someone can help me please...


1.

Exec '"$INSTDIR\reic\refresh.cmd"'

2.

Section
SetOutPath $INSTDIR
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"$INSTDIR\reic\refresh.cmd"'
SectionEnd

3.

Section
nsExec::Exec '"$INSTDIR\reic\refresh.cmd"'
Pop $0
SectionEnd
JasonFriday13#
SetOutPath "$INSTDIR\reic"
ExecShell open "$INSTDIR\reic\refresh.cmd"

Or hide the window like this:

SetOutPath "$INSTDIR\reic"
ExecShell open "$INSTDIR\reic\refresh.cmd" "" SW_HIDE
Anders#
Section
InitPluginsDir
FileOpen $0 "$PluginsDir\test.cmd" w
FileWrite $0 "@echo off$\r$\n"
FileWrite $0 "ping localhost$\r$\n"
FileClose $0
nsExec::Exec '"$sysdir\cmd.exe" /C "$PluginsDir\test.cmd"'
Pop $0
DetailPrint "Returned $0"
SectionEnd