English 中文(简体)
cygwin s expect doesn t work with net use?
原标题:

I need to automate the net use command on cygwin.

The command is net use /user:"name" somewhere . And Enter the password for name to connect to prosseek : is expected to enter the password.

It works well with command line input, and when run inside batch file. It doesn t work when I make a expect script as follows.

spawn net use /user:"name" \prosseeksomewhere
expect "Enter the password for  name  to connect to  prosseek :"
send "password
"
interact

I get error message as follows.

spawn net use /user:"name" prosseeksomewhere
System error 67 has occurred.

The network name cannot be found.

send: invalid spawn id (4) while executing "send "password "" (file "conpros" line 9)

  • Q : What might be wrong?
  • Q : Can some MS command something like net use be working with cygwin/expect?
最佳回答

You probably can t use Cygwin s expect with non-cygwin programs; Cygwin emulates posix ptys, while the Windows programs use Windows own terminal handling code, which knows nothing about the pipelines that expect is trying to read from and write to.

You ve also failed to escape your backslashes in expect; notice that the error message gives a different string from the one you passed in.

问题回答

Here might be some suggestions:

Can you explore to prosseeksomewhere? If so I imagine that you may need to escape the backslashes \proseeksomewhere.

The network name piece might also indicate that it cannot resolve the host name.





相关问题
cygwin file path tab completion not working

How can I set up Cygwin to have tab completion? Actually, I do have it automatically, but it does not seem to complete paths. How do I set it up to complete paths?

cygwin version of idle has erroneous I/O handling

I am using idle (python 2.5) via cygwin on a windows vista machine and when I try to open an already existing .py file I see the full file path /home/aaron/C:/cygwin/home/aaron/script.py on the ...

Trying to get a terminal to work in Emacs

I ve been having a lot of problems with emacs and trying to get the terminal to work with: M-x term I installed cygwin and I fixed up my .emacs to include the paths: (setenv "PATH" (concat "...

Piping Cygwin into a Python program

As a i m new to the whole Piping thing and Python I had recently encountered a problem trying to pipe Cygwin s stdin & stdout into a python program usin Python s subprocess moudle. for example I ...

Unable to chdir() on Git/Cygwin

I installed Git via Cygwin on Windows Server. It works out very well. However there s a small issue that when I clone a repo use the command as following: $git clone git@myserver:project.git I ...

Linux Development C/C++/bash/python on windows-7

Before resorting to stackoverflow, i have spend a lot of times looking for the solutions. I have been a linux-user/developer for few years, now shifting to windows-7. I am looking for seting-up a ...

Cygwin/Git/Gitosis unable to push new repository

I ve recently set up cygwin, git, and gitosis on my Windows Server 2003 box and am having troubles. I ve followed just about every tutorial I can find to the letter, and have confirmed that my git ...

热门标签