Skip to content

Bug: can't read registered tasks on windows #545

@zumm

Description

@zumm

If scheduled task has double quotes in command arguments, resticprofile can't parse it (unschedule and status commands fail). This may happen if path to config needs to be escaped, for example:

resticprofile -c "C;\folder with spaces\profiles.yaml" schedule --all

This task is schduled:
Command: resticprofile.exe
Arguments: --no-ansi --config "C;\folder with spaces\profiles.yaml" run-schedule backup@default

And now we are unable to unschedule it:

resticprofile -c "C:\folder with spaces\profiles.yaml" unschedule --all
2025/07/31 00:06:50 loading task "\resticprofile backup\default backup": %!w(*csv.ParseError=&{2 2 235 0x21c7670})
2025/07/31 00:06:50 no scheduled jobs found

Problem is getCSV can't parse output of schtasks cuz output contains unescaped double quotes:

schtasks /query /fo csv /v /tn "\resticprofile backup\default backup"

"HostName","TaskName","Next Run Time","Status","Logon Mode","Last Run Time","Last Result","Author","Task To Run","Start In","Comment","Scheduled Task State","Idle Time","Power Management","Run As User","Delete Task If Not Rescheduled","Stop Task If Runs X Hours and X Mins","Schedule","Schedule Type","Start Time","Start Date","End Date","Days","Months","Repeat: Every","Repeat: Until: Time","Repeat: Until: Duration","Repeat: Stop If Still Running"
"HOSTNAME","\resticprofile backup\default backup","2025-08-01 00:00:00","Ready","Interactive only","1999-11-30 00:00:00","267011","resticprofile","resticprofile.exe --no-ansi --config "C:\folder with spaces\profiles.yaml" run-schedule backup@default","C:\Windows\system32","resticprofile backup for profile default in C:\folder with spaces\profiles.yaml","Enabled","Disabled","Stop On Battery Mode, No Start On Batteries","HOSTNAME\zumm","Disabled","Disabled","Scheduling data is not available in this format.","Daily ","N/A","N/A","N/A","Every 1 day(s)","N/A","Disabled","Disabled","Disabled","Disabled"

A possible solution is to use the /xml flag to get the output in XML format. However, this flag cannot be used together with /v.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions