Practical Exercise: Automating a Program Launch at Logon
Objective
• Create a batch file to open a program.
• Use Task Scheduler to run the batch file when a user logs in.
Materials Needed
• Windows 10 or Windows 11 PC
• Notepad (for creating the batch file)
• Task Scheduler (built into Windows)
Step 1: Create a Batch File
1. Open Notepad.
2. Type the following command:
3. @echo off
4. start [Link]
5. exit
(This batch file will open Notepad when executed.)
6. Save the file as a .bat file:
o Click File > Save As...
o Change "Save as type" to "All Files"
o Name it "[Link]"
o Save it in a location like C:\Users\Public (or a folder of your choice).
Step 2: Schedule the Batch File to Run at Logon
1. Open Task Scheduler:
o Press Win + R, type [Link], and press Enter.
2. Create a New Task:
o Click Create Basic Task (on the right panel).
o Name it "Open Notepad at Logon", then click Next.
3. Set the Trigger:
o Choose "When I log on", then click Next.
4. Set the Action:
o Select "Start a Program", then click Next.
o Click Browse and locate the batch file ([Link]).
o Click Next.
5. Finish the Setup:
o Review the settings and click Finish.
Step 3: Test the Task
• Log out and log back in.
• Notepad should automatically open after logging in!
Additional Challenge (For Fast Learners)
• Modify the batch file to open multiple programs, e.g., Notepad and Calculator:
• @echo off
• start [Link]
• start [Link]
• exit
• Schedule it to run only at specific times of the day instead of at logon.
Expected Outcome
By the end of this exercise, students will:
Understand how batch files work.
Learn to automate tasks using Task Scheduler.
Gain practical experience in basic scripting.