1

I am simply trying to run a test script in python using task scheduler, for which I need to make a .bat file of to let it be able to run. This is the current bat file:

"‪C:\Program Files (x86)\Python38-32\python.exe" "C:\Users\Declan\Documents\_Automation\test.py"
pause

However it is giving me the following

C:\Users\Declan\Documents\_Automation>"ÔǬC:\Program Files (x86)\Python
38-32\python.exe" "C:\Users\Declan\Documents\_Automation\test.py"
The filename, directory name, or volume label syntax is incorrect.

C:\Users\Declan\Documents\_Automation>pause
Press any key to continue . . .
2
  • 2
    "ÔǬC:\ there might be a special character right after the first " Commented Jan 6, 2020 at 0:36
  • when i added a script in task scheduler, i had to put the path up to the script name in the 'start in' field, so in your example start in: C:\Users\Declan\Documents_Automation\ Commented Jan 6, 2020 at 1:13

1 Answer 1

1

This is likely an encoding issue. Check the character encoding of your batch file.

If you don't know how, simply create a new one, using your favourite text editor and instead of copying and pasting the text from the original source, just rewrite the batch file from scratch.

However, if you have more than just a bare bones text editor (like Notepad++, UltraEdit, etc.) there will be menu options that allow you to inspect and change the encoding of an existing file. UTF-8 without a BOM, or Ansi (varies depending on code page) are options to try.

In case you're wondering: not all text files are created equally. On disk, a text file (like any file) is just a series of bytes and each character of the 'text' is represented by a number of bytes (the exact number depends on the encoding). What character is represented by the byte sequences depends on the chosen character encoding for the file - many encodings will use the same byte sequences for the most common characters, but may use different byte sequences for non-standard characters, or use specific sequences to represent characters that aren't in other encodings. Think about special characters that are needed in some languages, but not in others for example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.