Automatic Command Line input for Batch Processing

Source: Internet
Author: User
Tags scp command

When transferring files from windows to Linux, after OpenSSH is installed, use the SCP command in cmd. You need to enter the password after executing the command so that it cannot be called in the program. Batch processing is not very familiar. After finding some information on the Internet, the result is as follows: Because the RunAs command is similar, this is generally used on the Internet as an example.

1. http://www.cn-dos.net/forum/viewthread.php? Tid = 34574

Method 1: Use sendkeys of vbs to enter the password <br/> echo set PWS = wscript. createobject ("wscript. shell ")> % Temp %/PWS. vbs <br/> echo PWS. sendkeys "1 {enter}" >>% TEMP %/PWS. vbs <br/> wscript % Temp %/PWS. vbs & RunAs/u: test1 cmd.exe <br/> Method 2: Use the/savecred parameter <br/> creden must be created for the first time when an independent user executes a program, in the meantime, the password will not be displayed again. You cannot see it. If you lose the password, press Enter. <Br/> in the future, you do not need to enter a password. <Br/> RunAs/u: test1 cmd.exe enter the password and press ENTER <br/> RunAs/savecred/u: test1 explorer no longer need to enter the password <br/> method 3: replace RunAs with runtime xec in pstools

 

 

2. A vbs example

Http://www.cn-dos.net/forum/viewthread.php? Tid = 29795 & fpage = 5

 

3. Some people claim to write the password to another file, which can be solved through redirection. However, no one confirmed the success.

Http://topic.csdn.net/t/20060504/23/4730647.html

Some people say that the echo. psw | method cannot be used. "The echo method is only valid for standard streams. If it is a program that uses BIOS programming to detect the keyboard, there will be no way ."

 

Vbs is successful, but a disgusting dialog box is displayed every time you run vbs: Click OK to try again or enter an alternate path to a folder containing the installation package PDF. MSI in the box. I don't know how to solve this problem.

Write down the record for the moment. Wait for a good time to learn the batch processing and then look at the redirection method.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.