Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th August 2020, 12:00   #1
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
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
galtech is offline   Reply With Quote
Old 11th August 2020, 10:32   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 893
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

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 12th August 2020, 02:04   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
PHP Code:
Section
InitPluginsDir
FileOpen 
$"$PluginsDir\test.cmd" w
FileWrite 
$"@echo off$\r$\n"
FileWrite $"ping localhost$\r$\n"
FileClose $0
nsExec
::Exec '"$sysdir\cmd.exe" /C "$PluginsDir\test.cmd"'
Pop $0
DetailPrint 
"Returned $0"
SectionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump