Reputation: 69
I earlier posted this question: Check real path or content of job/task
This may have been a bit confusing, so I'm rephrasing: what I want is the content, name, description etc. of a task on the system.
For example, I want to know which tasks contain or execute iexplore.exe.
I have used the following command:
schtasks /query /fo LIST /v | findstr /i /s "iexplore.exe"
This will give me the output:
Task to Run: C:\Program Files\Internet Explorer\iexplore.exe
But this is insufficient information. Ideally, I want to have listed: Name, Location, Description
If I use:
schtasks /query /v | findstr /i /s "iexplore.exe"
I get a whole bunch of output, unsorted and not all relevant (I don't want to know the battery mode etc.)
Is there a way to accomplish the output I'd like (for example:)
Task to run: C:\Program Files\Internet Explorer\iexplore.exe
Name: Management
Description: Open Management Interface
Location: %userprofile%\desktop\Management.html
Is this possible at all via schtasks? And if not, can I use the dir command somehow, in a list format or at least clean output as above?
I would like the output to be piped into a log or text file (as I have some scripts, I can just put it in there).
Thank you!
Upvotes: 0
Views: 2213
Reputation: 56190
EDITED now it handles every occurence of "iexplore.exe"
@echo off
setlocal enabledelayedexpansion
set "task="
for /f "tokens=2 delims=," %%a in ('schtasks /query /fo csv /v ^| find /i "iexplore.exe"') do (
set "task=%%~a"
schtasks /query /fo list /v /tn "!task!"|findstr /c:"Aufgabenname" /c:"Kommentar" /c:"Starten in" /c:"Auszufhrende Aufgabe"
)
NOTE: The names are dependent on the language of the windows installation. Most of your criterias don't exist on my windows, so I used my local names. Please adapt them to your needs.
Upvotes: 1