I would like to uninstall a program via bathc using the wmic method. I would like a message saying "uninstalling..." and then "done" right after, without going to the next line. Below is the code I'm trying, but it doesn't work:
set /p a=Uninstalling XXXXX...........<nul
wmic product where name="XXXXXXX" call uninstall >null<nul
set /p a=Done<nul
echo.
Any help would be appreciated!
The following uses a trick posted to DosTips by Jeb. I Believe it's what you're after.
@echo off
setLocal enableDelayedExpansion
copy nul sub.tmp /a > nul
for /F %%a in (sub.tmp) DO set "sub=%%a"
del sub.tmp
call :echoWithoutLinefeed "Uninstalling XXXXX..........."
wmic product where name="XXXXXXX" call uninstall >null
call :echoWithoutLinefeed " Done"
:echoWithoutLinefeed
> txt.tmp (echo(%~1!sub!)
copy txt.tmp /a txt2.tmp /b > nul
type txt2.tmp
del txt.tmp txt2.tmp
exit /b