1.

Solve : catching control characters?

Answer»

HI

Is it possible to catch the control characters like ctrl-D or ctrl-C in the batch file.

Thanxgive an example of what you wanna do...1. I need to do telnet in a batch file just for validation and invoke some 'X' application

2. I can't use languages like perl/vbscript/python/java, except DOS batch script

3. while doing telnet in the batch file if the user types ctrl-D, it is COMING out from the telnet session and
PROCEEDING further. So, if I can suppress(unset) ctrl-D then user can't escape the telnet authentication.

4. User to successfully login to the telnet session then only he can PROCEED further in the batch file.

5. EXAMPLE:

@ECHO OFF
telnet
ECHO %ERRORLEVEL%
pause

...
Actually I am a UNIX guy, I am not familiar with DOS. Please suggest me some ideas keeping in view of my
limited resources.
Thankx
Quote

1. I need to do telnet in a batch file just for validation and invoke some 'X' application

2. I can't use languages like perl/vbscript/python/java, except DOS batch script

3. while doing telnet in the batch file if the user types ctrl-D, it is coming out from the telnet session and
proceeding further. So, if I can suppress(unset) ctrl-D then user can't escape the telnet authentication.

4. User to successfully login to the telnet session then only he can proceed further in the batch file.

5. EXAMPLE:

@ECHO OFF
telnet <host name>
ECHO %ERRORLEVEL%
pause
<invoke some X application>
...
Actually I am a UNIX guy, I am not familiar with DOS. Please suggest me some ideas keeping in view of my
limited resources.
Thankx


1) when you say invoke 'X' application, is 'X' at remote or local?
2) how restricted are you? you can't run WSH/CSRIPT (vbscript) even?
3) u can try setting your batch to telnet to server using automatic login (-a) or (-l)
eg telnet -a host , or telnet -l username host
If all else fails, you can try ftp login using the -s option , if the user has supplied the correct credential and password, he can continue.


Thanks ghost

I can use wsh/cscript. Could U provide me a working example. Inside the script, I just telnet to a Unix server and EXIT from the telnet session and invoke some 'X' application which is a local one NOT a remote one.

The reason for telnetting is just to validate the Unix login. If his password expires, it will force and he can change the password at regular intervals.

ThankX again for ur prompt response.don't know whether it works. you can try it out
http://sourceforge.net/projects/telscript/


Discussion

No Comment Found