How to Execute Files in The Task Scheduler That Have Spaces
Don't hesitate to apply our quick procedure right away
3 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Some 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 can I 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 to 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 in 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”
The example above encloses the first file path 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 run at the time scheduled within the command. A full command might look like the one in the snapshot 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.
If you are facing the Task Scheduler failed to launch an action issue, we suggest you check out this solution guide.
User forum
0 messages