Bat file returns error but works correctly

IMB

I have the following .bat file which used to work without any error but for some reason it's started to return an error every time I run it.

Here's the .bat file:

C:
start "" "C:\Program Files (x86)\NetBeans 7.0.1\bin\netbeans.exe"
D:
start "" "D:\standalone\My AutoHotkey Script.ahk"

The error:

enter image description here

JdeBP

You wrote your command script in UTF-8. Those three characters are the UTF-8 encoding of the Unicode Byte Order Mark, U+FEFF, displayed in code page 437. Scripts for Microsoft's command processor are always treated by the command processor as if encoded the current "OEM" code page (clearly 437 in your case), and should be written as such.

The reason that everything looked alright in Notepad is that Notepad recognizes BOMs and decodes the file accordingly. What Notepad was showing you was not what the command processor actually sees in the file.

Note that Notepad has no ability to read/write files in OEM code pages. If you are using characters in command scripts that are outwith the ASCII subset common to "OEM" and "Windows" code pages (fortunately, not the case here), then you cannot use Notepad for editing those scripts (unless you are capable of translating from "OEM" to "Windows" code pages in your head as you type).

Even then, you'll have trouble when Notepad silently prepends byte-order marks to your files when you accidentally save as UTF-8 instead of in the current Windows code page (which Notepad mis-names "ANSI"). That's almost certainly what happened here, in fact.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Launching a .reg within a .bat file

분류에서Dev

WMIC command not working in .bat file

분류에서Dev

Woocommerce API returns 1, but works

분류에서Dev

Java not writing to file correctly

분류에서Dev

How to sign a Windows batch (.bat) file?

분류에서Dev

Recursive directory processing in a BAT file with a twist

분류에서Dev

What is wrong with my if parameter syntax of this .bat file?

분류에서Dev

Open corresponding remote directory with bat file

분류에서Dev

How to start an application Maximized using a .bat file?

분류에서Dev

Error when delete files using bat

분류에서Dev

git log -- <file_name> works correct on terminal, but doing g.log(file_name) in git python shows error

분류에서Dev

Exist-DB: REST GET to stored XProc file (xpl extension) returns error

분류에서Dev

Extracting a password protected .7z file with 'p7zip' returns an error

분류에서Dev

PyOpenGL .obj file not displayed correctly

분류에서Dev

How to correctly execute .sh file?

분류에서Dev

select returns "No such file or directory"

분류에서Dev

How to launch a .bat file in VB without associating the file with the program that launched it?

분류에서Dev

Text file Side by Side Merge not working via Bat file

분류에서Dev

Replace a middle string in .bat file using AutoHotKey without deleting file

분류에서Dev

Script's function works correctly on resize but not on document.ready

분류에서Dev

Can I run a python script in arcpy from a .bat file?

분류에서Dev

how to get all the arguments in a command captured in a windows .bat file

분류에서Dev

Variables not showing up in bat file my program made

분류에서Dev

Passing credentials to a standalone RCP based application through .bat file

분류에서Dev

복사 % 0> file.bat 사용

분류에서Dev

where is the path of Ruby executable file and the gem.bat in linux?

분류에서Dev

Bat file doesn't log when running from task scheduler?

분류에서Dev

How to enable user actions after .bat file is executed

분류에서Dev

Excel VBA How to Execute BAT file in folders in current directory

Related 관련 기사

  1. 1

    Launching a .reg within a .bat file

  2. 2

    WMIC command not working in .bat file

  3. 3

    Woocommerce API returns 1, but works

  4. 4

    Java not writing to file correctly

  5. 5

    How to sign a Windows batch (.bat) file?

  6. 6

    Recursive directory processing in a BAT file with a twist

  7. 7

    What is wrong with my if parameter syntax of this .bat file?

  8. 8

    Open corresponding remote directory with bat file

  9. 9

    How to start an application Maximized using a .bat file?

  10. 10

    Error when delete files using bat

  11. 11

    git log -- <file_name> works correct on terminal, but doing g.log(file_name) in git python shows error

  12. 12

    Exist-DB: REST GET to stored XProc file (xpl extension) returns error

  13. 13

    Extracting a password protected .7z file with 'p7zip' returns an error

  14. 14

    PyOpenGL .obj file not displayed correctly

  15. 15

    How to correctly execute .sh file?

  16. 16

    select returns "No such file or directory"

  17. 17

    How to launch a .bat file in VB without associating the file with the program that launched it?

  18. 18

    Text file Side by Side Merge not working via Bat file

  19. 19

    Replace a middle string in .bat file using AutoHotKey without deleting file

  20. 20

    Script's function works correctly on resize but not on document.ready

  21. 21

    Can I run a python script in arcpy from a .bat file?

  22. 22

    how to get all the arguments in a command captured in a windows .bat file

  23. 23

    Variables not showing up in bat file my program made

  24. 24

    Passing credentials to a standalone RCP based application through .bat file

  25. 25

    복사 % 0> file.bat 사용

  26. 26

    where is the path of Ruby executable file and the gem.bat in linux?

  27. 27

    Bat file doesn't log when running from task scheduler?

  28. 28

    How to enable user actions after .bat file is executed

  29. 29

    Excel VBA How to Execute BAT file in folders in current directory

뜨겁다태그

보관