KpyM Telnet/SSH Server - Forum
Passing Files to batches |
Tors10 |
Passing Files to batches |
Nov 15 2006 20:51 |
|
Is there a way to pass Consc a batch file with an input file?
I've tried:
consc test.bat ipaddress
which said can't parse command at line 0
consc "test.bat ipaddress"
which said can't open file test.bat ipaddress
consc 'test.bat ipaddress'
which said can't open file 'test.bat
I'm trying to make use of the %1 operator when making my ssh connection...
I've noticed that:
consc test.bat
gives me the same error as as the first one that I posted. I'm assuming that consc takes all of the inputs as files to parse + execute, which means that it will not input the correct values to fill in the ipaddresses.
Can anyone think of a workaround?
|
Kroum Grigorov |
|
Nov 17 2006 14:44 |
|
You can't pass batch file directly to consc.
It has to be consc script file, it means you have to add 'SEND ' before each line of the batch file and '\n' et the end.
You can't pass additional parameters either however you can use ENVIRONMENT variables instead.
For example to pass the ip address you can do something like this:
[code:1:5be230918b]C:\consc>set ip_address=127.0.0.1
C:\consc>consc test.txt
[/code:1:5be230918b]
Here is the test.txt file, it will echo the ip address you supply
[code:1:5be230918b]SEND cls\n
SEND echo %ip_address%\n
SEND echo done\n
WAIT done
SEND exit\n
[/code:1:5be230918b]
You can wrap set command and consc command in a batch file that accepts multiple parameters on the command line.
Kroum
|
© 2007 - 2008 Kroum Grigorov