Latest Addition ==> Bob.Omb's Modified Win10PEx64 v4.4 - RS5

Author Topic: Autorun.CMD - Automatically run commands during boot.  (Read 267 times)

Bob.Omb

  • PE Baker
  • Administrator
  • Jr. Member
  • *****
  • Posts: 66
    • View Profile
Autorun.CMD - Automatically run commands during boot.
« on: September 03, 2018, 05:40:16 pm »
The Autorun.CMD provided at the root of your USB is able to create Start Menu shotcuts, Desktop shortcuts, automatically map network drives, and anything else you can do in a CMD file.  If you look inside you will see examples of how this is done.  Autorun.CMD runs 20 seconds after boot to give the system and network time to fully start.

This makes it easily possible to add portable applications to your USB.  Simply add the files anywhere on the Y:\ and create shortcuts pointing to those files with nircmd described inside the file. 

This is what the inside of the default Autorun.CMD at the root of your USB looks like:
Code: [Select]
@ECHO OFF
CLS

REM - Below are examples of additional ways to add custom shortcuts to your Desktop and Start Menu, how
REM - to automatically MAP network drives, and how to autorun a program at the end of boot. Remove REM
REM - from the beginning of the lines between the sections to test the commands. This file is run 20
REM - seconds after boot to ensure all drives are mounted and the network is started before executing.

REM -------------------------------------------------------------------------------------------------------
REM - To Create a custom shortcut on the "Desktop"
REM - nircmd shortcut - "pathtoexe" - (Desktop) - "shortcutname"
REM - Example: nircmd.exe shortcut "%SystemRoot%\system32\cmd.exe" "~$folder.desktop$" "Command Prompt"
REM - Example: nircmd.exe shortcut "Y:\Programs\PStart\PStart.exe" "~$folder.desktop$" "PStart"
REM -------------------------------------------------------------------------------------------------------

REM nircmd.exe shortcut "Y:\Programs\PStart\PStart.exe" "~$folder.desktop$" "PStart"

REM -------------------------------------------------------------------------------------------------------
REM - To Create a custom Folder AND Shortcut in the Start Menu
REM - nircmd shortcut - "pathtoexe" - (StartMenuFolder) - "shortcutname"
REM - Example: nircmd.exe shortcut "%SystemRoot%\system32\cmd.exe" "~$folder.programs$\Test" "Command Prompt"
REM - Example: nircmd.exe shortcut "Y:\Programs\PStart\PStart.exe" "~$folder.programs$\PStart" "PStart"
REM -------------------------------------------------------------------------------------------------------

REM nircmd.exe shortcut "Y:\Programs\PStart\PStart.exe" "~$folder.programs$\PStart" "PStart"

REM -------------------------------------------------------------------------------------------------------
REM - To add a custom shortcut to the root of the Start Menu
REM - nircmd shortcut - "pathtexe" - (StartMenuRoot) - "shortcutname"
REM - Example: nircmd.exe shortcut "%SystemRoot%\system32\cmd.exe" "~$folder.programs$" "Command Prompt"
REM - Example: nircmd.exe shortcut "Y:\Programs\Pstart\PStart.exe" "~$folder.programs$" "PStart"
REM -------------------------------------------------------------------------------------------------------

REM nircmd.exe shortcut "Y:\Programs\PStart\PStart.exe" "~$folder.programs$" "PStart"

REM -------------------------------------------------------------------------------------------------------
REM - To automatically MAP a network drive during boot
REM - net use [Driveletter]: [Path] /user:[username] [password]
REM - Example: net use Z: \\sharename\foldername /user:username password
REM -------------------------------------------------------------------------------------------------------

REM net use Z: \\Server\BackupData /user:bob mypassword

REM -------------------------------------------------------------------------------------------------------
REM - To autorun a program when the system starts
REM - Start - "title" - "pathtoexe"
REM - Example: Start "" Y:\Programs\Pstart\Pstart.exe
REM -------------------------------------------------------------------------------------------------------

REM Start "" Y:\Programs\Pstart\Pstart.exe

EXIT

Remove REM from in front of the commands between the instructions to test Autorun.CMD for yourself.
« Last Edit: September 03, 2018, 07:25:20 pm by Bob.Omb »

Bob.Omb

  • PE Baker
  • Administrator
  • Jr. Member
  • *****
  • Posts: 66
    • View Profile
Re: Autorun.CMD - Automatically run commands during boot.
« Reply #1 on: September 06, 2018, 08:11:46 pm »
I wish I would've named this Autoexec.bat  :o

(And a settings file called config.sys..)  ;)