Page 1 of 1

[SOLVED] chkdsk does not work when run from a BAT file

Posted: 15 Apr 2023 16:53
by DOSadnie
If I run this from CMD

Code: Select all

chkdsk T: /F /scan /perf
it works. But when I put it in a BAT file in execute it, even as an Administrator, it does nothing aside from flashing CMD window

I also tried reducing it to basic

Code: Select all

chkdsk T:
but still does not run it


Why does it not work?

Re: chkdsk does not work when run from a BAT file

Posted: 15 Apr 2023 17:50
by ShadowThief
There shouldn't be any problem. Open a command prompt and run the script from there instead of double-clicking it so that you can see what the error is.

Re: chkdsk does not work when run from a BAT file

Posted: 24 Apr 2023 15:17
by DOSadnie
This is what happens

Code: Select all

C:\>test.bat

C:\>■
'■' is not recognized as an internal or external command,
operable program or batch file.

C:\>
Where thas this ■ sign comes from?

Re: chkdsk does not work when run from a BAT file

Posted: 24 Apr 2023 16:48
by ShadowThief
That's a result of you saving the file with the wrong encoding. Your batch script must be saved as ANSI or else it will not work correctly.

Re: chkdsk does not work when run from a BAT file

Posted: 28 May 2023 09:11
by DOSadnie
That checks out, thank you

[Also saving BAT with UTF-8 encoding allows for successful running of it]