Note that there are some explanatory texts on larger screens.

plurals
  1. PORemoving carriage return from WMIC output
    primarykey
    data
    text
    <p>Using below command in a batch file, i am getting output but along with some echoes as carriage return.</p> <pre><code>wmic process where Caption='notepad.exe' get ProcessId,WorkingSetSize /Format:Texttable &gt; output.txt </code></pre> <p><strong>output:</strong></p> <pre><code>ProcessId WorkingSetSize 4016 6356992 1548 6189056 </code></pre> <p>how to get rid of this carriage return in output ?</p> <p><strong>EDIT1:</strong></p> <p>Referring Foxdrive's working answer in my linked question I tried below and its working nice, but in the output there coming an extra line: <strong>ECHO is off.</strong> don't know why ? </p> <pre><code>@echo off setlocal enabledelayedexpansion (For /F "tokens=1,* delims==" %%A in (' "wmic process where Caption='notepad.exe' get ProcessId,WorkingSetSize /Format:Texttable" ') do ( set "line=%%A %%B" set "line=!line:~0,-1!" echo !line! ))&gt;output.txt </code></pre> <p><strong>output.txt:</strong></p> <pre><code>ProcessId WorkingSetSize 4768 6365184 5608 5500928 2888 6037504 1052 5472256 ECHO is off. </code></pre> <p><strong>EDIT2:</strong></p> <pre><code>ProcessId WorkingSetSize 4768 6365184 5608 5500928 2888 6037504 1052 5472256 </code></pre> <p>I want output in above format only and getting that output using:</p> <pre><code>@echo off setlocal enabledelayedexpansion (For /F "delims=" %%A in ('"wmic process where Caption='notepad.exe' get ProcessId,WorkingSetSize /format:Texttable |findstr "[0-9P]" "') do ( set "line=%%A" echo !line:~0,-1! )) &gt; output.txt </code></pre> <p>Is there any trailing CR in output now ? hexdump command is not working in my system..:(..will appreciate your confirmation..:) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload