batch file - echo. is not working? -
i'm creating small program infamous windows update fail in windows 7! i'm using batch reason "echo." isn't showing blank lines. ideas. here's code below
@echo off :checkprivileges net file 1>nul 2>nul if '%errorlevel%' == '0' ( goto gotprivileges ) else ( goto getprivileges ) :getprivileges if '%1'=='elev' (shift & goto gotprivileges) echo. echo ************************************** echo invoking administration privledges echo ************************************** setlocal disabledelayedexpansion set "batchpath=%~0" setlocal enabledelayedexpansion echo set uac = createobject^("shell.application"^) > "%temp%\oegetprivileges.vbs" echo uac.shellexecute "!batchpath!", "elev", "", "runas", 1 >> "%temp%\oegetprivileges.vbs" "%temp%\oegetprivileges.vbs" exit /b :gotprivileges :::::::::::::::::::::::::::: :start :::::::::::::::::::::::::::: setlocal & pushd . rem run shell admin (example) - set progfiles86root=%programfiles(x86)% if not "%progfiles86root%"=="" goto win64 set progfiles86root=%programfiles% :win64 cls ::: _ _ _ _ _ _ _ ::: | | | |(_) | | | | | | | | ::: | | | |_ _ __ | | | |_ __ __| | __ _| |_ ___ ::: | |/\| | | '_ \| | | | '_ \ / _` |/ _` | __/ _ \ ::: \ /\ / | | | | |_| | |_) | (_| | (_| | || __/ ::: \/ \/|_|_| |_|\___/| .__/ \__,_|\__,_|\__\___| ::: ======================| |==============fixer v1.0=============== ::: |_| /f "delims=: tokens=*" %%a in ('findstr /b ::: "%~f0"') @echo(%%a timeout /t 10 >nul cls if exist %systemdrive%\winuf.dll (goto second) else goto begin :begin echo choosing run winupdate fixer echo. echo. echo program attempt fix windows update issues! echo continuing winupdate fixer reset windows update :choice set /p c=do want continue[y/n]? if /i "%c%" equ "y" goto :fix if /i "%c%" equ "n" goto :exit goto :choice :exit echo. echo. echo anyway! pause exit :fix rem. > %systemdrive%\winuf.dll echo. echo. echo. echo ******************************************************************************* echo fixing windows update echo ******************************************************************************* pause :second del /q /s /f %systemdrive%\winuf.dll >nul echo did program work pause
it's answered in comments, try summarize here.
using echo.
bad choice, fails when there exists file named echo
without extension in current directory.
, it's ~10 times slower echo(
scan current directory.
when start batch slow drive (like network share) can more worse.
as aacini mentioned use many other working variants empty line
echo/ echo: echo\ echo, echo; echo= echo(
but if want able output variable can contain content , allowed empty, should use echo(
seems safe variant.
set "var=any content /? on ..\..\windows\system32\calc.exe etc" echo(!var!
Comments
Post a Comment