Some users utilize Task Scheduler to set up scheduled tasks that open software and files. However, those scheduled tasks might not always work for users. That is often because the files the tasks need to open include spaces in their file titles. Consequently, a scheduled task might not open the software or a file it’s supposed to. However, it’s relatively easy to fix scheduled tasks that don’t open files with spaces.

How to Fix Scheduled Tasks That Include Files With Spaces

1. Add Quote Marks to the File Paths

  1. Users can fix the scheduled tasks by adding quotation marks around the paths that include file (or folder) spaces. To do that, press the Windows key + S hotkey, which will open the search utility.
  2. Enter ‘Task Scheduler’ in the search box.
  3. Click Task Scheduler to open the window shown directly below.Task Scheduler how to execute files in the Task Scheduler that have spaces
  4. Double-click Task Scheduler Library on the left of the window to expand it.
  5. Select the folder that includes the scheduled task that needs fixing.
  6. Then right-click the scheduled task and select Properties.
  7. Select the Actions tab in the snapshot directly below.Actions tab how to execute files in the Task Scheduler that have spaces
  8. Select Start a program, and then press the Edit button. The Edit Action window will then open.Edit Action window how to execute files in the Task Scheduler that have spaces
  9. If the Program/script path does not include quotation marks around it, add them to the beginning and end of the path.
  10. Then add quotation marks at the beginning and end of the file path included within the Add arguments box.
  11. Click the OK button.
  12. Then press the OK button on the properties window.

2. Delete Spaces From File Titles

  1. Alternatively, try deleting spaces from file and folder titles within the paths included for the scheduled task. To do that, open File Explorer with the Windows key + E hotkey.
  2. Then open the folder that includes the task file with spaces in it.
  3. Right-click the file and click the Rename option.The Rename option how to execute files in the Task Scheduler that have spaces
  4. Delete all the spaces from the file title.
  5. Then press the Enter key.
  6. If any of the folder titles within the software or file paths include spaces, remove the spaces from the folder titles.

3. Add Backslash and Quote Marks to File Paths in the Command Prompt

Users who utilize the Schtasks.exe Command Prompt utility to schedule tasks need to include additional backslash (\) and quote (“) marks around the file path with spaces (excluding arguments or switches) within the command. For example, a file path with arguments in the schtasks /create command would look something like this:

\”c:\foldername with spaces\file.bat\” arguments”

Instead of this:

“c:\foldername with spaces\file.bat arguments”

In the example above, the first file path is enclosed within  “\ and \” character combinations. However, arguments is left outside the character combinations; but it is still enclosed within the quote marks. With those character combinations included around the path, the task will then run at the time scheduled within the command. A full command might look something like the one in the snapshot directly below.

The schtasks command how to execute files in the Task Scheduler that have spaces

So, users can add quotation marks to the file paths in the Edit Action window, remove spaces from file paths, or add character combinations around file paths that include spaces in Schtasks commands. Then the scheduled tasks should work.

RELATED ARTICLES TO CHECK OUT: