Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ipconfig output CR without LF

67 views
Skip to first unread message

Tom Del Rosso

unread,
Apr 25, 2012, 3:45:49 PM4/25/12
to
This is always a problem when FOR parses the output of IPCONFIG.
There's a work-around, but I can't remember what it is. I thought
piping through MORE or SORT would do it but no difference.


--
Reply in group, but if emailing add one more
zero, and remove the last word.


foxidrive

unread,
Apr 25, 2012, 4:31:19 PM4/25/12
to
On 26/04/2012 05:45, Tom Del Rosso wrote:
> This is always a problem when FOR parses the output of IPCONFIG.
> There's a work-around, but I can't remember what it is. I thought
> piping through MORE or SORT would do it but no difference.

This converts the 0D0D0A line end to an 0D0A and removes blank lines. Is that helpful?


@echo off
for /f "delims=" %%a in ('ipconfig /all') do (
for /f "delims=" %%b in ('echo.%%a') do echo.%%b>>file.txt
)




--
Mic

foxidrive

unread,
Apr 25, 2012, 4:35:51 PM4/25/12
to
This also works.


@echo off
del file.txt 2>nul
for /f "delims=" %%a in ('ipconfig /all') do cmd /c echo.%%a>>file.txt



--
Mic

Tom Del Rosso

unread,
Apr 25, 2012, 4:38:17 PM4/25/12
to
Tom Del Rosso wrote:
> This is always a problem when FOR parses the output of IPCONFIG.
> There's a work-around, but I can't remember what it is. I thought
> piping through MORE or SORT would do it but no difference.

So it seems to require saving the token in an evar, then chopping it
off. Sucks.

Tom Del Rosso

unread,
Apr 25, 2012, 4:50:11 PM4/25/12
to
Great! Thank you. Oddly, calling cmd is a little faster.

Dr J R Stockton

unread,
Apr 26, 2012, 2:10:29 PM4/26/12
to
In alt.msdos.batch.nt message <jn9l6h$okv$1...@dont-email.me>, Wed, 25 Apr
2012 15:45:49, Tom Del Rosso <td...@verizon.net.invalid> posted:

>This is always a problem when FOR parses the output of IPCONFIG.
>There's a work-around, but I can't remember what it is. I thought
>piping through MORE or SORT would do it but no difference.

Piping through COLS 1- will do it, although increasing spacing.
Get COLS via sig line 3.

And ipconfig | mtr -o \r\n = \r\n \n = \r\n \r = \z
will also do it, preserving spacing. That's using the 10th example in
its Help. Change the o to an h to see the offending characters being
fixed, without output

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

Petr Laznovsky

unread,
Apr 27, 2012, 5:28:14 AM4/27/12
to
On 26.4.2012 20:10, Dr J R Stockton wrote:
> In alt.msdos.batch.nt message<jn9l6h$okv$1...@dont-email.me>, Wed, 25 Apr
> 2012 15:45:49, Tom Del Rosso<td...@verizon.net.invalid> posted:
>
>> This is always a problem when FOR parses the output of IPCONFIG.
>> There's a work-around, but I can't remember what it is. I thought
>> piping through MORE or SORT would do it but no difference.
>
> Piping through COLS 1- will do it, although increasing spacing.
> Get COLS via sig line 3.
>
> And ipconfig | mtr -o \r\n = \r\n \n = \r\n \r = \z
> will also do it, preserving spacing. That's using the 10th example in
> its Help. Change the o to an h to see the offending characters being
> fixed, without output
>

In case external utility usage, you can forget whole ipconfig and use:

getwmiproperty -namespace root\cimv2 -class
win32_networkadapterconfiguration -property
description,ipaddress,ipsubnet,defaultipgateway


language independent and can be easily parsed.

L.

Klaatu

unread,
May 15, 2012, 2:24:38 PM5/15/12
to
On Fri, 27 Apr 2012 09:28:14 GMT, Petr Laznovsky posted to
alt.msdos.batch.nt:

> In case external utility usage, you can forget whole ipconfig and use:
>
> getwmiproperty -namespace root\cimv2 -class
> win32_networkadapterconfiguration -property
> description,ipaddress,ipsubnet,defaultipgateway

'getwmiproperty' is not recognized as an internal or external command,
operable program or batch file.

--
def.: recursion: see recursion.

Petr Laznovsky

unread,
May 16, 2012, 2:38:38 AM5/16/12
to
On 15.5.2012 20:24, Klaatu wrote:
> On Fri, 27 Apr 2012 09:28:14 GMT, Petr Laznovsky posted to
> alt.msdos.batch.nt:
>
>> , you can forget whole ipconfig and use:
>>
>> getwmiproperty -namespace root\cimv2 -class
>> win32_networkadapterconfiguration -property
>> description,ipaddress,ipsubnet,defaultipgateway
>
> 'getwmiproperty' is not recognized as an internal or external command,
> operable program or batch file.
>

My post started with "In case external utility usage"

Klaatu

unread,
May 16, 2012, 1:08:08 PM5/16/12
to
On Wed, 16 May 2012 06:38:38 GMT, Petr Laznovsky posted to
alt.msdos.batch.nt:

> On 15.5.2012 20:24, Klaatu wrote:
>> On Fri, 27 Apr 2012 09:28:14 GMT, Petr Laznovsky posted to
>> alt.msdos.batch.nt:
>>
>>> , you can forget whole ipconfig and use:
>>>
>>> getwmiproperty -namespace root\cimv2 -class
>>> win32_networkadapterconfiguration -property
>>> description,ipaddress,ipsubnet,defaultipgateway
>>
>> 'getwmiproperty' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>
> My post started with "In case external utility usage"

Yes, which I included. To what external utility do you refer? You did not
specify. A link would suffice.

--
"It is better to keep your mouth shut and appear stupid, than to open it
and remove all doubt"
-- Mark Twain

ten.n...@virgin.net

unread,
May 16, 2012, 6:20:25 PM5/16/12
to
WMIC is built in, from XP onwards.

::----- START -----
WMIC NICConfig where "IPEnabled='True'" get Description, IPAddress,
IPSubnet, DefaultIPGateway /value|FIND "="
::------ END ------

billious

unread,
May 16, 2012, 9:30:07 PM5/16/12
to
On 17/05/12 06:20, ten.n...@virgin.net wrote:
> On Tue, 15 May 2012 19:24:38 +0100, Klaatu <kla...@nospam.invalid> wrote:
>
>> On Fri, 27 Apr 2012 09:28:14 GMT, Petr Laznovsky posted to
>> alt.msdos.batch.nt:
>>
>>> In case external utility usage, you can forget whole ipconfig and use:
>>>
>>> getwmiproperty -namespace root\cimv2 -class
>>> win32_networkadapterconfiguration -property
>>> description,ipaddress,ipsubnet,defaultipgateway
>>
>> 'getwmiproperty' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>
> WMIC is built in, from XP onwards.
>

Not in XP/H it isn't.

Klaatu

unread,
May 17, 2012, 9:54:17 AM5/17/12
to
On Thu, 17 May 2012 01:30:07 GMT, billious posted to alt.msdos.batch.nt:
Regardless, in Windows 7 Enterprise typing GETWMIPROPERTY in a command
window generates the above message...

--
What was the greatest thing before sliced bread?

Petr Laznovsky

unread,
May 17, 2012, 10:19:15 AM5/17/12
to
Maybe my lack of english: By external utility I mean program which IS
NOT included with OS. Do you have access to Google?

L.

Klaatu

unread,
May 17, 2012, 11:13:35 AM5/17/12
to
On Thu, 17 May 2012 14:19:15 GMT, Petr Laznovsky posted to
alt.msdos.batch.nt:
How condescending...

Look, if you don't want to answer the question, fine, but don't try to
play games. What is it about "there is no GETWMIPROPERTY command" you
don't understand?

I'm very (well, somewhat) familiar with WMI and the WMIC command itself,
and I'm well aware VBScript has a GETWMIPROPERTY function, but that still
doesn't resolve the underlying point that typing GETWMIPROPERTY into a
command window does not resolve to anything useful.

Now, since it's "NOT included with OS" where is this GETWMIPROPERTY.CMD
or .EXE or whatever? And if you don't want to answer, fine, but there's
no need to hurl insults like "Google it".

--
No matter how good she looks someone is really sick of her shit by now.

Petr Laznovsky

unread,
May 17, 2012, 6:27:09 PM5/17/12
to
http://glsft.free.fr/index.php?option=com_content&task=view&id=70&Itemid=28

BTW: First link I got after put "getwmiproperty" into google search box.

L.

foxidrive

unread,
May 17, 2012, 8:47:22 PM5/17/12
to
On 18/05/2012 08:27, Petr Laznovsky wrote:
>
> http://glsft.free.fr/index.php?option=com_content&task=view&id=70&Itemid=28
>
> BTW: First link I got after put "getwmiproperty" into google search box.
>
> L.

Klaatu has a point. There is no certainty that the first link in google is the one you were referring to.



--
Mic

Tom Del Rosso

unread,
May 17, 2012, 9:27:22 PM5/17/12
to
foxidrive wrote:
>
> Klaatu has a point. There is no certainty that the first link in
> google is the one you were referring to.

And google links are personalized, so your first could be my tenth.

Petr Laznovsky

unread,
May 18, 2012, 7:35:36 AM5/18/12
to
On 18.5.2012 3:27, Tom Del Rosso wrote:
> foxidrive wrote:
>>
>> Klaatu has a point. There is no certainty that the first link in
>> google is the one you were referring to.
>
> And google links are personalized, so your first could be my tenth.
>
>
Could be, but I have a reasonable doubts this is the case we are talking
about.
This keyword is REALY special (in fact, this is more likely phrase
without spaces than one single word) and I post also full command with
parameters. Klaatu can find, download, try and verify, but hi choose to
write posts to group instead. His choice, but I do not prefer such
behaviour.

Google customization can be turned off for sure, then it`s only excuse.

L.

BTW: I am for long time member of local networking community where "Are
you trying to save your time and steal my time, asking me googling for
you?" is something like 'capital offence' ;-)

foxidrive

unread,
May 18, 2012, 8:52:50 AM5/18/12
to
On 18/05/2012 21:35, Petr Laznovsky wrote:
> On 18.5.2012 3:27, Tom Del Rosso wrote:
>> foxidrive wrote:
>>>
>>> Klaatu has a point. There is no certainty that the first link in
>>> google is the one you were referring to.
>>
>> And google links are personalized, so your first could be my tenth.
>>
>>
> Could be, but I have a reasonable doubts this is the case we are talking
> about.
> This keyword is REALY special

It's in google alright, and on my google search page it is the fifth link - on a webpage that is in French. It is still a marked link in my browser because I've tried the getwmiproperty utility before and it doesn't work on my Windows XP operating system.


Arguing the point and maintaining that we should all use google doesn't help when it's on a French web site.



--
Mic

Petr Laznovsky

unread,
May 18, 2012, 10:35:26 AM5/18/12
to
> I've tried the getwmiproperty utility before and it doesn't work on my Windows XP operating system.


You can try again, there are three new versions since march (two of them
based on my bugreport)

L.

Tom Del Rosso

unread,
May 18, 2012, 11:21:08 AM5/18/12
to

Petr Laznovsky wrote:
> On 18.5.2012 3:27, Tom Del Rosso wrote:
> > foxidrive wrote:
> > >
> > > Klaatu has a point. There is no certainty that the first link in
> > > google is the one you were referring to.
> >
> > And google links are personalized, so your first could be my tenth.
> >
> >
> Could be, but I have a reasonable doubts this is the case we are
> talking about.
> This keyword is REALY special (in fact, this is more likely phrase
> without spaces than one single word) and I post also full command with
> parameters. Klaatu can find, download, try and verify, but hi choose
> to write posts to group instead. His choice, but I do not prefer such
> behaviour.

But you are posting to the group.


> Google customization can be turned off for sure, then it`s only
> excuse.

Not really. They always track you. IXquick.com and duckduckgo.com don't
but google always makes use of tracking and they give different people
different links.


> BTW: I am for long time member of local networking community where
> "Are you trying to save your time and steal my time, asking me
> googling for you?" is something like 'capital offence' ;-)

He didn't ask you to google it.

As I see it, the most important issue is this: Your first post didn't even
make clear that it was a command that could be executed in a batch script.
It could have been intended to run in any of a dozen other script engines.
Even in this group there are posts with other languages. You could have
simply said that it was an exe. All he asked for was clarification.

Petr Laznovsky

unread,
May 18, 2012, 12:44:50 PM5/18/12
to
> Your first post didn't even
> make clear that it was a command that could be executed in a batch script.

My first post started with: "In case external utility usage...." I can`t
realize this is not clear.
I am sorry for misunderstanding, but english is not my first language
and was learned without supervision...

L.

Tom Del Rosso

unread,
May 18, 2012, 1:25:38 PM5/18/12
to
An script engine is also an external utility.

Petr Laznovsky

unread,
May 18, 2012, 1:40:17 PM5/18/12
to
On 18.5.2012 19:25, Tom Del Rosso wrote:
> Petr Laznovsky wrote:
>>> Your first post didn't even
>>> make clear that it was a command that could be executed in a batch
>>> script.
>>
>> My first post started with: "In case external utility usage...." I
>> can`t realize this is not clear.
>> I am sorry for misunderstanding, but english is not my first language
>> and was learned without supervision...
>
> An script engine is also an external utility.
>

Not in my point of view, those are shipped with OS, therefor those are
internal programs.




Tom Del Rosso

unread,
May 18, 2012, 1:58:17 PM5/18/12
to
There are others that have to be downloaded.
0 new messages