How to append characters in a line

W

Wensi Peng

Hello,

I have leaned here how to add characters in front of a line by SET /P.
Today I would like to ask how to append characters in a line?

Example:

original output:

IP: 10.1..1.1
IP: 10.1.1.2
...........
IP: 10.1.1.n

Now I want to append vendor name, for instance

IP: 10.1..1.1 IBM server
IP: 10.1.1.2 HP server
...........
IP: 10.1.1.n DELL server

Thanks,
Wensi
 
J

Jerold Schulman

Hello,

I have leaned here how to add characters in front of a line by SET /P.
Today I would like to ask how to append characters in a line?

Example:

original output:

IP: 10.1..1.1
IP: 10.1.1.2
..........
IP: 10.1.1.n

Now I want to append vendor name, for instance

IP: 10.1..1.1 IBM server
IP: 10.1.1.2 HP server
..........
IP: 10.1.1.n DELL server

Thanks,
Wensi
for /f "Tokens=1,2" %%a in ('type filename') do (
"%commonProgramFiles%\Microsoft Shared\msinfo\MSINFO32.EXE" /computer %%b /categories systemsummary /report "%TEMP%\MSINFO.TMP"
:: parse the "%TEMP%\MSINFO.TMP" and extract the Manufacturer and OS type.
)



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
W

Wensi Peng

I was asking a general question fro appending characters. It is independent
on any specifical commands.

Thanks,
Wensi
Jerold Schulman said:
for /f "Tokens=1,2" %%a in ('type filename') do (
"%commonProgramFiles%\Microsoft Shared\msinfo\MSINFO32.EXE" /computer %%b
/categories systemsummary /report "%TEMP%\MSINFO.TMP"
 
D

Dean Wells [MVP]

I'm not sure I understand what you're asking since you already know how
to use 'set /p' ... post your current script in order to assist.
 
P

Phil Robyn (MVP)

Wensi said:
I was asking a general question fro appending characters. It is independent
on any specifical commands.

Thanks,
Wensi

- - - - - - - - - - begin screen capture WinXP - - - - - - - - - -
C:\cmd>demo\AppendingText
my_variable is [This is some text ]
my_variable is [This is some text and this is appended.]

C:\cmd>rlist demo\AppendingText.cmd
=====begin C:\cmd\demo\AppendingText.cmd ====================
1. @echo off
2. setlocal
3. set "my_variable=This is some text "
4. echo my_variable is [%my_variable%]
5. set my_variable=%my_variable% and this is appended.
6. echo my_variable is [%my_variable%]
=====end C:\cmd\demo\AppendingText.cmd ====================
- - - - - - - - - - end screen capture WinXP - - - - - - - - - -

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top