Hi
I need a little help to improve my new batch to show or delete a numbered task names
The code below works fine if the task name does not contains a space
So i'm looking how can i modify it to read a task name with a space
Thank you for any help
@echo off
Title Delete Tasks with their time tasks execution by Hackoo 2017
Mode 90,30 & color 0A
:Menu
cls & echo(
echo Type the time with this format "hh:mm" to show or delete for scheduled Tasks
set /a "count=0"
set /p "strTime="
cls & echo(
Setlocal EnableDelayedExpansion
@for /f "tokens=1 delims= " %%a in ('schtasks /query ^| find /I "%strTime%"') do (
set /a "Count+=1"
set "TaskName[!Count!]=%%a"
)
Rem Display numbered Task Names
@for /L %%i in (1,1,%Count%) do (
set "msg=[%%i] - !TaskName[%%i]!"
echo !msg!
)
echo(
Rem Asking the user if he wants to delete or not the numbered task names
echo Type the number of the task to delete !
set /p "Input="
@for /L %%i in (1,1,%Count%) Do (
If "%INPUT%" EQU "%%i" (
schtasks /delete /tn "!TaskName[%%i]!"
)
)
echo(
echo Type any key to show and delete another task !
Pause>nul
Goto Menu