Batch with Title not showing when executing with Task Scheduler

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Batch with Title not showing when executing with Task Scheduler

#1 Post by SIMMS7400 » 13 Apr 2017 14:52

Hi Folks -

I'm working on a solution that requires me to use a title as filter in order to ONLY terinate certain CMD sessions.

If I execute the script manually, the session is inclusive of a title.
If executed with Task Scheduler, no title is associated with the cmd session?

Why is this?

Test:

Batch:

Code: Select all

TITLE Jarvis_Landry_is_a_joke
pause


Output:

Code: Select all

Image Name:   cmd.exe
PID:          318540
Session Name: RDP-Tcp#0
Session#:     1
Mem Usage:    2,952 K
Status:       Running
User Name:    PELOTON\Administrator
CPU Time:     0:00:00
Window Title: Administrator: Command Prompt - tasklist  /v /fi "imagename eq cmd.exe" /fo list

Image Name:   cmd.exe
PID:          278260
Session Name: RDP-Tcp#0
Session#:     1
Mem Usage:    2,884 K
Status:       Running
User Name:    PELOTON\Administrator
CPU Time:     0:00:00
Window Title: Administrator:  Jarvis_Landry_is_a_joke


But when I execute the same script using Task Scheduler, I get N/A for Title:

Code: Select all

Image Name:   cmd.exe
PID:          238680
Session Name: Services
Session#:     0
Mem Usage:    128,224 K
Status:       Unknown
User Name:    PELOTON\srvc-oracle
CPU Time:     0:00:19
Window Title: N/A

Image Name:   cmd.exe
PID:          156540
Session Name: RDP-Tcp#0
Session#:     1
Mem Usage:    2,944 K
Status:       Running
User Name:    PELOTON\Administrator
CPU Time:     0:00:00
Window Title: Administrator: Command Prompt - tasklist  /v /fi "imagename eq cmd.exe" /fo list


Does anyone know why?

THanks!

igor_andreev
Posts: 16
Joined: 25 Feb 2017 12:55
Location: Russia

Re: Batch with Title not showing when executing with Task Scheduler

#2 Post by igor_andreev » 13 Apr 2017 16:25

"PELOTON\srvc-oracle" when invoked from Scheduler, not "PELOTON\Administrator". Try run scheduled task as current Logged In user.

Post Reply