Skip to content
⌘ NSIS Forum Archive

Pass !define to nsexec cmd.exe

5 posts

StealUrKill_PhD#

Pass !define to nsexec cmd.exe

Is is possible to pass from nsis to cmd.exe?

I can manually type it in but it will change everytime its compiled again.


!define File_Name "test.exe"
Function .onInit
    nsExec::Exec '"$sysdir\cmd.exe" /c if 1==1 del "%userprofile%\Desktop\$File_Name"' /f /s
FunctionEnd 
StealUrKill_PhD#
I was able to figure it out, thanks.

I am using the define due to me using it under
Name
OutFile

!define File_Name "test.exe"
Var /Global APPNAME
Function .onInit
    StrCpy $APPNAME ${File_Name}
    nsExec::Exec '"$sysdir\cmd.exe" /c if 1==1 del "%userprofile%\Desktop\$APPNAME"' /f /s
FunctionEnd 
StealUrKill_PhD#
I actually tried that first and did not seem to work. I guess I should have stated that as well. I might have typed something wrong and did not notice it. I will setup another test and see. Thanks.