Polyglot

From NSIS Wiki
Jump to navigationJump to search


Batch (NT)

/*>nul 2>&1&@echo off&rem Note that this line will be visible when executed
echo Hello World
goto :EOF &rem */
 
Page InstFiles
 
Section
  DetailPrint "Hello World"
SectionEnd

C/C++

#define /*
!define /**/ MYNUMBER 1234

#if 0 /* NSIS */
Page InstFiles
 
Section
  DetailPrint "Hello World"
SectionEnd
!if 0
#else /* C */
#include <stdio.h>
 
int main()
{
  return !printf("Hello World\n");
}
#if 0
!endif
#endif
#endif //~ EOF */

C#

#if NSIS
Page InstFiles
 
Section
  DetailPrint "Hello World"
SectionEnd
!if 0
#elif !NSIS
using System;
 
class TestApp {
  public static void Main()
  {
    Console.WriteLine("Hello World");
  }
}
#else
!endif
#endif

Inf

/*
[Version]
Signature=$CHICAGO$
 
[DefaultInstall]
AddReg=AddReg
 
[AddReg]
HKLM,Software\Test,,,"Hello World"
 
[Strings]
[EOF]
*/
 
Page InstFiles
 
Section
  DetailPrint "Hello World"
SectionEnd