Announcement

Collapse
No announcement yet.

Pass !define to nsexec cmd.exe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.


    PHP Code:
    !define File_Name "test.exe"

    Function .onInit
        nsExec
    ::Exec '"$sysdir\cmd.exe" /c if 1==1 del "%userprofile%\Desktop\$File_Name"' //s
    FunctionEnd 

  • #2
    You need to learn the difference between a $variable and a ${define}.
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      I was able to figure it out, thanks.

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

      PHP Code:
      !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"' //s
      FunctionEnd 

      Comment


      • #4
        You don't need to copy it to a variable, just do ...\Desktop\${File_Name}"' /f /s
        IntOp $PostCount $PostCount + 1

        Comment


        • #5
          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.

          Comment

          Working...
          X