Running Task manually doesn't show cmd.exe window while running.


croberts

Member
Local time
5:15 PM
Posts
2
OS
Windows 11
* Machine: Windows 2025 Datacenter v24h2.

I'm trying to manually run a batch file using a task under Task Scheduler. The ultimate goal is to have the batch file run automatically at set times. I have set up the task and am testing it by running it manually under my username, let's call my username "User1". But we have set it up to run automatically under another username "BatchUser".

The .bat file is running without an error when I start it but does not show the cmd.exe window so I can see its progress. Here's my command line for the Action:

Code:
c:\windows\system32\cmd.exe
And my parameter:
Code:
/k "e:\Jobs\Prod\myproject\gotestt.bat"

The /k is supposed to mean show the cmd.exe window while it runs. This works fine on my laptop which was upgraded from Windows 10 to Windows 11 this week.

Any idea how to manually run this task and show the cmd.exe window while I view the output of the program?

Thanks.
 
Windows Build/Version
Windows 2025 Datacenter v24h2.
Last edited:

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Omen 30L GT13-1xxx
    CPU
    AMD Ryzen 5 5600G with Radeon Graphics, 3901 Mhz
    Memory
    16GB
    Graphics Card(s)
    NVidia GeForce RTX 3060
    Internet Speed
    50Mb/s download
Windows isolates user sessions, which is nice for security and privacy reasons. You wouldn't see what's in another user account's session unless that app was designed to do so. I can't even think of an example of one that is.

Probably the simplest thing to do is start a command prompt with the scheduled task's account (run as different user), and either run the scheduled task or the command directly.
 

My Computer

System One

  • OS
    Windows 11 Pro 25H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Core i7-1260P
    Motherboard
    NUC12WSBi7
    Memory
    64 GB Micron PC4-25600
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    on-board Realtek HD Audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840 x 2160
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Crucial MX500 2 TB
    Antivirus
    Microsoft Defender
I cannot tell from what you've written which comments apply to running the batch file under your user account and which apply to trying to run it under somebody else's user account.

You cannot display any user interface whilst running under somebody else's user account and any command [such as the cmd.exe or the batch file] that tries to do so will not run.
I do not know why you are running a batch file using cmd.exe instead of just running the batch file & having a pause line at the end of the batch file.


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
is the task set to "run only when user is logged on" or "run whether user is logged on or not"? it needs to be the former
 

My Computer

System One

  • OS
    Windows 11 Pro
is the task set to "run only when user is logged on" or "run whether user is logged on or not"? it needs to be the former
The setting is "run whether user is logged on or not". We would like these batch files to run using this other user called "BatchUser", so I don't have to be logged in when it runs. It can run if I'm out of the office or home sick.

We want it to be like a Unix cron job (which we used to use): set up a job to run even if no one is logged in, and run it, get data from someplace, make a spreadsheet and email it to users automatically. I have the same tasks working fine in my Win 11 laptop but we wanted to put all these automatic programs on a central server.

But our Unix machine is being retired and we are moving over to Windows.

EDIT: If I manually run the task (to test it) with the setting "Run only if the user is logged on" it doesn't run at all.

My testing steps are:
  1. Run the task manually, check output. (I am at this step.)
  2. Run the task on a schedule to make sure it works.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Omen 30L GT13-1xxx
    CPU
    AMD Ryzen 5 5600G with Radeon Graphics, 3901 Mhz
    Memory
    16GB
    Graphics Card(s)
    NVidia GeForce RTX 3060
    Internet Speed
    50Mb/s download

Latest Support Threads

Back
Top Bottom