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
- 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.
- Enter ‘Task Scheduler’ in the search box.
- Click Task Scheduler to open the window shown directly below.
- Double-click Task Scheduler Library on the left of the window to expand it.
- Select the folder that includes the scheduled task that needs fixing.
- Then right-click the scheduled task and select Properties.
- Select the Actions tab in the snapshot directly below.
- Select Start a program, and then press the Edit button. The Edit Action window will then open.
- If the Program/script path does not include quotation marks around it, add them to the beginning and end of the path.
- Then add quotation marks at the beginning and end of the file path included within the Add arguments box.
- Click the OK button.
- Then press the OK button on the properties window.
2. Delete Spaces From File Titles
- 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.
- Then open the folder that includes the task file with spaces in it.
- Right-click the file and click the Rename option.
- Delete all the spaces from the file title.
- Then press the Enter key.
- 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.
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: