Luca Morri
Luca Morri

Reputation: 1

Invoking command prompt from Tcl in windows with key

I create a simple script in command prompt, test.cmd. When I run

c:\test.cmd myname
is your MyName [Y/n]

now I put Y or n and press enter to continue. How can i automate this in Tcl script?

I created test.tcl

exec test.cmd myname &
after 500
puts  "Y\r"

but it is not working. Do you have any suggestions?

Upvotes: 0

Views: 97

Answers (1)

glenn jackman
glenn jackman

Reputation: 246754

Try

set input "Y"
puts [exec test.cmd << $input]

Refer to the exec documentation

Upvotes: 2

Related Questions