Wiki‎ > ‎

Encrypt shell script on Linux and BAT file on Windows

posted Apr 26, 2017, 12:19 PM by Danny Xu   [ updated Oct 17, 2017, 2:39 PM ]

  1. Write your script (

    echo "Hello World" 
  2. Encrypt your script (give a password):

    openssl enc -e -aes-256-cbc -a -in > script-enc 
  3. Write de Wrapper (

    openssl enc -d -aes-256-cbc -a -in script-enc | sh - 
  4. Run "", enter the password, and the script will run without write the plain text script on disk.

Windows Batch

Here are 2 free programs that I highly recommend for creating EXE's out of batch files

1 - Bat To Exe Converter

2 - Bat 2 Exe

You can use both programs with simple GUI.

Bat To Exe Converter supports also CLI commands (\? flag for help). Basic example from documentation:

Bat_To_Exe_Converter.exe -bat mybatfile.bat -save myprogram.exe -icon myicon