Computing.Net > Forums > Windows XP > CMD: putting multiple lines in one

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

CMD: putting multiple lines in one

Reply to Message Icon

Name: blink
Date: June 19, 2007 at 01:02:22 Pacific
OS: WIN XP
CPU/Ram: P4/1GB
Product: HP
Comment:

Using the dsquery command I create lists of what groups a user has. This looks something like this:

"CN=App1,OU=User Groups,OU=Unit,DC=directory,DC=local"
"CN=App2,OU=User Groups,OU=Unit,DC=directory,DC=local"
"CN=Domain Server Ops,OU=Migrate Groups,OU=User Groups,OU=Unit,DC=directory,DC=local"
"CN=Domain Account Ops,OU=Migrate Groups,OU=User Groups,OU=Unit,DC=directory,DC=local"

I want this output to be put in one line, divided bij a semicolon (;). How can I accomplish this in cmd?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 19, 2007 at 04:13:30 Pacific
Reply:

@echo off > newfile
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set s=!s!%%a;
)
echo !s:~0,-1!>> newfile



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: blink
Date: June 19, 2007 at 06:54:21 Pacific
Reply:

Nice! Works great!

What if I'd want to keep the multiple lines but add a set variable in front of each line, followed by the semicolon and the rest of the line?


0

Response Number 3
Name: Mechanix2Go
Date: June 19, 2007 at 20:12:35 Pacific
Reply:

@echo off > newfile
setLocal EnableDelayedExpansion

set myvar=this
for /f "tokens=* delims= " %%a in (myfile) do (
echo !myvar!%%a;>>newfile
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Help! PC can't boot-up, p... different desktop?



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: CMD: putting multiple lines in one

Ati all in one 7500 line in no soun www.computing.net/answers/windows-xp/ati-all-in-one-7500-line-in-no-soun/63580.html

Notepad shows text in one line. www.computing.net/answers/windows-xp/notepad-shows-text-in-one-line/58102.html

Windows and Linux in one DVD www.computing.net/answers/windows-xp/windows-and-linux-in-one-dvd/179756.html