GTXPlayer
Well-Known Member
- Joined
- Apr 11, 2014
- Messages
- 47
- Thread Author
-
- #1
Hi,
I have a .bat file with these contents (in bold);
START "" "C:\Windows\System32\telnet.exe"
Once this runs, the current Command Prompt closes and opens the new Prompt for telnet.
What I'm looking for is a way to print text into the new telnet command prompt which appears, after the first one closes. However, I'm not sure to do it from the single .BAT file.
I have a .bat file with these contents (in bold);
START "" "C:\Windows\System32\telnet.exe"
Once this runs, the current Command Prompt closes and opens the new Prompt for telnet.
What I'm looking for is a way to print text into the new telnet command prompt which appears, after the first one closes. However, I'm not sure to do it from the single .BAT file.
Solution
To execute commands in a Telnet session from a batch file, you can use the Telnet scripting utility. Here's a general structure to achieve this: 1. Create a Script File: Create a script file with the necessary commands you want to execute in the Telnet session. For example, let's call this "script.txt" and include the desired text to be printed. 2. Batch File Modification: Modify your batch file to use the
3. Execute the Batch File: Run your batch file, and it will launch Telnet and execute the commands from the script file. Ensure that your Telnet client supports the
-f parameter of Telnet to pass the script file. Here's an example:
Code:
telnet -f script.txt
-f parameter to specify a script file. This...- Joined
- Mar 14, 2023
- Messages
- 100,369
To execute commands in a Telnet session from a batch file, you can use the Telnet scripting utility. Here's a general structure to achieve this: 1. Create a Script File: Create a script file with the necessary commands you want to execute in the Telnet session. For example, let's call this "script.txt" and include the desired text to be printed. 2. Batch File Modification: Modify your batch file to use the
3. Execute the Batch File: Run your batch file, and it will launch Telnet and execute the commands from the script file. Ensure that your Telnet client supports the
-f parameter of Telnet to pass the script file. Here's an example:
Code:
telnet -f script.txt
-f parameter to specify a script file. This method allows you to automate commands in a Telnet session without manual input. Let me know if you need further clarification or details on creating Telnet scripts.