Skip to main content
12 events
when toggle format what by license comment
Mar 6, 2022 at 7:18 comment added Ghost_Dz Thanks for the deep explanation , i did that for tall him u can do e r r o r l e v e l without %%
Mar 5, 2022 at 22:09 comment added Scott - Слава Україні (Cont’d) …  But when you see %>, with no intervening space, it’s less obvious that they are parts of two separate tokens.)  But, since you included a space before the ) in your command, it writes the eleven printable characters errorlevel⁠ ⁠, including the space (and also CR and LF).  So what’s the point?
Mar 5, 2022 at 22:09 comment added Scott - Слава Україні (Cont’d) …  So why do you believe that your suggestion is relevant or useful?  (2) The whole point of my suggestion with the parentheses is to allow a somewhat-aesthetic (i.e., “pretty”-looking) command — with spaces before and after the > — that doesn’t silently write a space to the file.  (Users of English — and remember that English is the official language of Stack Exchange — are accustomed to seeing graphical characters immediately after ( and before ), with no intervening space. … (Cont’d)
Mar 5, 2022 at 22:09 comment added Scott - Слава Україні @Ghost_Dz: (1) It appears from the question that the OP wants to write the twelve graphical characters %errorlevel% to the file.  Your suggestion writes only the ten graphical characters errorlevel.  The question also shows that the OP knows that echo something > filename will write something to the file, so if they had wanted to write the ten graphical characters errorlevel, they would have known enough to do echo errorlevel > error.txt. … (Cont’d)
Mar 5, 2022 at 17:35 comment added Ghost_Dz ( >errorlevel.txt ECHO errorlevel ) without %%
Mar 3, 2022 at 10:26 comment added Io-oI @RicardoBohner correct, i saw it here..
Mar 2, 2022 at 21:30 comment added Ricardo Bohner @iTwasnTme >error.txt echo ^!!errorlevel^!! saves the error number but I think we are talking about saving the word errorlevel with percentage or exclamation marks here....
Mar 2, 2022 at 16:34 comment added Ricardo Bohner In case you had DelayedExpansion enabled and would like to save !errorlevel! it would be something like echo ^^!errorlevel^^!>error.txt
Mar 2, 2022 at 6:10 comment added Io-oI >error.txt echo %%errrorlevel%%
Mar 2, 2022 at 6:05 comment added dave_thompson_085 Actually it writes %...% space CR LF. Another way to avoid the space (but not the CR LF) is echo>error.txt %%errorlevel%% but I don't claim beauty.
Mar 2, 2022 at 3:44 history edited Scott - Слава Україні CC BY-SA 4.0
Added generic warning about `echo something > somefile`.
Mar 2, 2022 at 3:33 history answered Scott - Слава Україні CC BY-SA 4.0