How to append characters in a line

  • Thread starter Thread starter Wensi Peng
  • Start date Start date
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
 
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
 
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"
 
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.
 
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 - - - - - - - - - -

 
Back
Top