How to Make Windows Task Scheduler Show CMD Window When Running Batch Files (Windows Server 2008 R2)


6 views

Many Windows Server administrators and developers face this issue - when scheduling batch files via Task Scheduler, the command prompt window remains invisible. This becomes particularly frustrating when you need to monitor script execution or debug issues.

Task Scheduler by default runs tasks in a non-interactive session, even when set to "Run only when user is logged on". The session isolation in Windows Server 2008 R2 is more restrictive than client OS versions.

After extensive testing on Windows Server 2008 R2, these methods reliably display the CMD window:

Method 1: Using START with Interactive Mode

Create your scheduled task to run:

cmd /c start "Batch Window" /wait C:\path\to\your\script.bat

Key parameters:

- start launches new window

- Title in quotes prevents confusion with START options

- /wait keeps window open after completion

Method 2: VBS Wrapper Script

For more control, create a VBS script to launch your batch:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /k C:\path\to\your\script.bat", 1, False
Set WshShell = Nothing

Schedule the VBS file instead of batch directly. The 1 makes window visible, /k keeps window open after execution.

Method 3: Task Scheduler Configuration

Ensure these settings in your scheduled task:

  • General tab: Select "Run only when user is logged on" (not "Run whether user is logged on or not")
  • General tab: Check "Run with highest privileges"
  • Conditions tab: Uncheck "Start the task only if the computer is on AC power"

For modern environments, consider converting to PowerShell with explicit window display:

Start-Process cmd.exe -ArgumentList "/k C:\path\to\your\script.bat" -WindowStyle Normal

If the window still doesn't appear:

  • Check Task Scheduler history for errors
  • Test with a simple batch file containing just @echo Hello World & pause
  • Verify the scheduled task runs under the correct user account

Many administrators face a common frustration when scheduling batch files on Windows Server 2008 R2 - the CMD window simply won't appear during execution. This behavior differs from manual execution where the console window remains visible throughout the batch process.

The Task Scheduler normally executes tasks under the SYSTEM account with hidden windows by default. Even when using interactive settings or the cmd /c start approach, the window visibility often remains suppressed.

Method 1: Using the START Command with Correct Parameters

Create a wrapper batch file with this structure:

@echo off
START "Batch Runner" /MIN cmd /k "C:\path\to\your\batchfile.bat"
exit

Method 2: Direct Task Scheduler Configuration

Set these properties in your scheduled task:

- Action: Start a program
- Program/script: cmd.exe
- Arguments: /c start "Title" /wait "C:\path\to\batch.bat"
- Check "Run only when user is logged on" (critical)
- Set "Run with highest privileges"

Method 3: Using VBScript as Intermediate

Create a .vbs file with this content:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /c C:\path\to\batch.bat", 1, False
Set WshShell = Nothing
  • For servers: Enable "Interactive Services Detection" service
  • Set task to run under specific user account (not SYSTEM)
  • Combine with timeout /t in batch file to keep window open

If the window still doesn't appear:

  1. Verify the task runs under an interactive session
  2. Check "Allow task to be run on demand" in task properties
  3. Test with a simple batch containing echo Hello World & pause