ja-lol
ja-lol

Reputation: 43

run cygwin terminal using vb

i need a code to type and perform commands in cygwin terminal in hidden mode(background) using visual basic, i was using cmd but now i want to use a Linux source code so i must use linux. i ran cmd in hidden mode successfully but it isn't working with cygwin, here is the cmd code:
Shell("cmd.exe /k tracert -h " & _h & " " & domain.Text & " > temp" & i + 1 & ".txt & exit", AppWinStyle.Hide, True)

so i have tried

Shell(""C:\cygwin\Cygwin.bat -k tracert -h " & _h & " " & domain.Text & " > temp" & i + 1 & ".txt & exit", AppWinStyle.Hide, True)

and

Shell("C:\cygwin\Cygwin.bat") 'SendKeys.Send("tracert -h " & _h & " " & domain.Text & " > temp" & i + 1 & ".txt"))

but this still didn't work where in the second code i still have to press enter in cygwin to process the traceroute and which should be automaticcaly processed, so i hope that i'll find help in here.

Upvotes: 0

Views: 1380

Answers (1)

ja-lol
ja-lol

Reputation: 43

Shell("C:\cygwin\Cygwin.bat")

SendKeys.Send("tracert -h " & _h & " " & domain.Text & " > temp" & i + 1 & ".txt"))

SendKeys.Send("{ENTER}")

this is the answer, icase anyone needed this.

Upvotes: 1

Related Questions