Similar Posts

Subscribe
Notify of
10 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Windoofs10
8 months ago

You can do this in principle with any app you can write text and save it as a file.

It would be best if you can export the file as “.txt” because you only need to rename the file under Windows to “.bat” and then run the file directly.

If you can only export the file as a “docx”, it appears that you need to convert the text into a “.txt” under Windows, or to store the content in the editor and then as a “.bat”.

Hope you can help.

Erzesel
8 months ago
Reply to  Windoofs10

…not .bat (Dos-Batch), but .cmd (Windows-Batch) . Under recent Win 11 installations, the extension was. .bat removed from the registry.

(The difference is in error handling. )

cleanercode
8 months ago
Reply to  Erzesel

And if you do not use Windoof 11, it is still .bat 🙂 The answer is therefore completely i. O.

Windoofs10
8 months ago
Reply to  Erzesel

Oh, okay.

I didn’t know because you can still create .bat files and run them🤷

cleanercode
8 months ago
VERIFY > nul

You’re welcome.

Basically, you are right, but you should always lead a child. With batch and shell it is no different.

Erzesel
8 months ago

And if you do not use Windoof 11, it is still .bat 🙂 The answer is therefore completely i. O.

not!

see the explanation in the comments, is inadvertently addressed to the wrong addressees.

can save the following practical demo as .bat and .cmd, the difference is considerable!

set /a "Num=2/0" 2>nul   &rem  erzeugt  ganz  gewiss eien Fehler (division durch 0)
if %errorlevel% neq 0 (
    echo Fehler in der Formel!
    echo aktueller Errorlevel: %ErrorLevel%
)
 rem nächste Berchnung
set /a "variable=1+1"  &rem garantiert alles ok!
if %errorlevel% neq 0 (
    echo Fehler in der Formel!
    echo aktueller Errorlevel: %ErrorLevel%
)
pause
Erzesel
8 months ago

For over 25 years, Microsoft was gracious with vergreisten administrators who used their Batchscripte since MS-Dos 3.3 and did not like to separate from them.

In Batch, many results of operations are signaled by a change in the %Errorlevel%.

command.com (the Dos command interpreter) had a bug. Some commands may set an error level <>0, but did not set an error level=0. Thus, the error level set somewhere/wann could not be reset for a long time. This remains for compatibility reasons up to the introduction of Windows NT.

With NT the ending was fixed for Batch .cmd and the sorry error level bug was fixed. Now the respective commands set the error level to 0 if no error occurred. (That’s right, the Errororlevel is supposed to provide a (decision) information of the last command and not of sometime)

Depending on whether a batch was stored as .bat or .cmd, cmd.exe uses a different error management

Simple demo to test:

(call) &rem Errorlevel 1 setzen
echo aktueller Errorlevel: %ErrorLevel%
set "variable=blubb"  &rem kein Fehler audgetreten,  sollte  eigentlich den  erreorlevel 0 setzen
echo aktueller Errorlevel: %ErrorLevel%
pause

Because millions of debes didn’t understand the matter and there was never official documentary about Batch, a “curator” wrote off the other. …and because a batch in the previous reference works was always called .bat, this was also passed on in the blind flight.

Ok the real professionals knew it, but they wrote neither books nor bloggs

So it remained debes bringing new debes something deppertes (…and ChatGPT does not make an exception)

Windoofs10
8 months ago

Oh, I use Win 11 and with me that’s so xD

Probably because I have not (more) the latest one.

NorbertWillhelm
8 months ago

You need a text editor app.

For Android, I use Jota Text Editor (albeit old).

Nemesis900
8 months ago

A batch file is nothing but an executable text file that can be created with any text editor. Something like that should be pre-installed on any smartphone. Under Android in case of doubt Google Docs or Microsoft Word.