help converting .vbs to vb.net

knowmeifyou

Active member
Joined
Jun 16, 2013
Messages
26
Programming Experience
Beginner
i want to re write the vbscript to vb.net codes

so far this is my codes

1.png

and this is the error

2.png

and this is the some of the script i want to rewrite

Set cloner = CreateObject("WScript.Shell")cloner.run"cmd"
WScript.Sleep 500


cloner.SendKeys"telnet 192.168.1.1"
cloner.SendKeys("{Enter}")
WScript.Sleep 500
 
As I said in your thread about using Shell, DO NOT use SnedKeys to do this. It's a complete hack. Process.Start allows you to redirect the process input stream so you can send instructions directly to it.

Automate Command Prompt Window (CMD), Redirect Output to Application

As for the instruction you're sending, what happens if you just open a command prompt manually and type in the same thing?
 
tnx sir jmcilhinney

this is the output of the command(using the code from the link you gave me sir)
telnet 192.168.1.1
5.png

and this is doing manually
run the cmd from the start menu then then typing "telnet 192.168.1.1"

6.png

and about you're question
what happens if you just open a command prompt manually and type in the same thing?

it work properly sir

but from the link you gave me sir. ping -t google.com works properly but telnet command doesn't work



 
Back
Top