1.

Solve : data stripping?

Answer»

Hi all

im TRYING to automate a process, between 2 PC's that use win23k. What i want to do is,

1. log onto PC2 via PC1 using TELNET
2. print data on PC2, logging this into a .txt file on PC1.
3. then strip out only parts of the txt file to create a command file to put this data into PC1.
>PC1 and PC2 are a working pair, so want to batch this job as i have MANY other pairs that need checking and having the same data, just possibly different file sizes and hold timers set.

example print would look something like this

C:\TEMP>aprint -l
TABLE OF DATA

DATA STORE DATA
123 OTHER ftp
File SIZE 1024
holding time 600
Fixed SIZE YES

Statistics since :07/12/2008 00:00:54
Process start :01/26/2009 03:19:27
Volume read (Kb) :8625132
Volume reported (Kb) :8624816
Conn ATTEMPTS :80

4. I just need to be able to strip "1024" & "600" out.
5. then put 1024 & 600 into the following command using VARS...or whatever.

adef -l 1024 -h 600

6. I dont have any other tools, programmes on the PC other stand standard dos commands. - and cant load any other programmes either.

Your help would be appreciated.
Jo.Quote

6. I dont have any other tools, programmes on the PC other stand standard dos commands. - and cant load any other programmes either.

did you really mean standard dos?? or is it win nt cmd.exe (the black box window that some people mistakenly think is dos).

i dont have a solution for standard dos, but the following code is tested on:
C:\>ver
Microsoft Windows XP [Version 5.1.2600]

Code: [Select]@echo off & setlocal

for /f "skip=4 tokens=2,3" %%a in (test.txt) do if not defined vtime set v%%a=%%b
echo adef -l %vsize% -h %vtime%
Quote
1. log onto PC2 via PC1 using telnet

Logging on to a computer using Telnet could potentially be malicious. Reno
did you really mean standard dos?? or is it win nt cmd.exe (the black box window that some people mistakenly think is dos).
> cmd.exe it is.

& many thanks for the help with the code, i will try it out.

BatchFileCommand
Logging on to a computer using Telnet could potentially be malicious.
> These comps are all behind very heavy firewalls, and can only "talk" to each other. Thats why telnet is a viable OPTION, and the only option.

I get a logon prompt thats always the same (we use pragma telnet server) the only thing that would be different is the user input for the username and password. So any help in performing that task would be great.

Many Thanks so far
Dalii dont have telnet access to try.

type telnet -help or telnet /? to see if anything intresting can be found there. and paste the help info here.

also try this code to see if it can pass username to telnet.
echo usernamehere|telnet hostnamehereCode: [Select]echo usernamehere|telnet hostnamehere
Or you can do this:


Code: [Select]echo %username% | telnet hostnamehere

That is a system set variable that automatically puts your user name.lQuote from: dali1972 on March 06, 2009, 10:06:34 AM
6. I dont have any other tools, programmes on the PC other stand standard dos commands. - and cant load any other programmes either.
sorry, but this is a rant. I don't see why you can't load any programs that makes your programming life easier. If you are a programmer doing a batch job like this for your company, you can have your boss approve the use of those tools. doing telnet automation with sucky telnet client from windows just doesn't cut it. What happens after this ?
Code: [Select]echo usernamehere|telnet hostnamehere
you are expected to execute some commands on the other side. The above statement is not enough to do all that. Get a real programming language that have libraries that supports the Telnet protocol with proper error control. your boss should understand you have these restrictions.


Discussion

No Comment Found