“startup.nsh: The UEFI Shell’s Hidden Autopilot”

In the UEFI Shell, the default auto-run script is:

👉 startup.nsh

How it works

  • When the UEFI Shell starts, it automatically looks for and executes a file named:startup.nsh
  • It searches the root directory of mapped filesystems in order:fs0:\startup.nsh fs1:\startup.nsh fs2:\startup.nsh ...
  • The first one found is executed.

Typical use cases

  • Automating boot commands
  • Loading drivers
  • Running diagnostics
  • Launching an OS loader or firmware tools

Example startup.nsh

echo -off
map -r
fs0:
cd EFI\BOOT
BOOTX64.EFI

Important notes

  • The script must be exactly named startup.nsh (case-insensitive).
  • It must be in the filesystem root (not a subdirectory).
  • If multiple filesystems have it, only the first discovered is run.
  • You can disable auto-execution by launching the shell with:Shell.efi -nostartup

Debug tip

If your script isn’t running:

map
ls fs0:\

to verify filesystem mapping and file location.

About the Author

Yogi

24 years of experience in various layers of software. Primarily experienced in system side software design and development on server management software. Interested in linux development in x86 and arm architecture.