Skip to content

Instantly share code, notes, and snippets.

@Ravlissimo
Forked from davidruhmann/EchoOnSameLine.bat
Created May 7, 2023 06:32
Show Gist options
  • Save Ravlissimo/4c2bce8b660e489491e6d69ba8f1e4f7 to your computer and use it in GitHub Desktop.
Save Ravlissimo/4c2bce8b660e489491e6d69ba8f1e4f7 to your computer and use it in GitHub Desktop.
[Batch] Alternate Method of echoing output onto the same line. No CR+LF !
@echo off
setlocal EnableDelayedExpansion
call :createSub
call :echoWithoutLinefeed "=hello"
call :echoWithoutLinefeed " world"
exit /b
:echoWithoutLinefeed
> txt.tmp (echo(%~1!sub!)
copy txt.tmp /a txt2.tmp /b > nul
type txt2.tmp
del txt.tmp txt2.tmp
exit /b
:createSub
copy nul sub.tmp /a > nul
for /F %%a in (sub.tmp) DO (
set "sub=%%a"
)
del sub.tmp
exit /b
:: jeb
:: http://www.dostips.com/forum/viewtopic.php?f=3&t=4213&p=23568#p23568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment