1834274 Members
1550 Online
110066 Solutions
New Discussion

Re: Batch file (.bat)

 
intp
Frequent Advisor

Batch file (.bat)

Hi,

How to write a batch file which

1)opens a telnet session ,
2)kick starts a process (shell script), which will be running in background.
3)disconnect telnet.

this way i can double click the batch file to run this process.

Thanks

5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Batch file (.bat)

Shalom intp,

By default .bat files are batch executables on Windows.

They don't mean a thing to Linux or Unix.

To find a shell script that does this, I suggest the itrc search function.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
spex
Honored Contributor

Re: Batch file (.bat)

intp,

The telnet which ships with Windows is not scriptable. You will need a third-party tool, such as Expect:

http://expect.nist.gov/#windows

PCS
Dave La Mar
Honored Contributor

Re: Batch file (.bat)

This can be performed in a simple C program from windows as well.

Regards,

-dl
"I'm not dumb. I just have a command of thoroughly useless information."
John Kittel
Trusted Contributor

Re: Batch file (.bat)

perhaps you are looking for a way to have a batch file on a Windows system start a process on a Unix system? If so, telnet is not required. A suite of Unix tools for windows would let you do this with an rsh (or remsh) command, or an ssh command if it needs to be more secure.

John ( also an intp!)
spex
Honored Contributor

Re: Batch file (.bat)

intp,

You could also create an account on your HP-UX box for the express purpose of running this shell script. Reference the script in the new user's ~/.profile (use 'nohup <scriptname> &'). Add 'exit 0' after the reference so that the session exits after the script begins running.

The script will run whenever the user logs in. This way, you just need to script the client login process, without passing any commands.

However, you will still need a third-party tool to automate the login.

PCS