BAT file maker bat receives input use cases

Source: Internet
Author: User

This article provides an example of how to make a bat file and gives the reader an example of how to receive input in a bat file. For beginners to learn the article, please master more advice.

Example (see my other article: NET use command details and case): I am now logged into the operating system with a native user, but want to be able to access the domain's folder, the steps are as follows:

Start-run--cmd:

1) Delete the existing connection to avoid "one user use ... Multi-Connection "problem.

NET use */delete

If the prompt "list is empty" means that there are currently no associated connections, if prompted "you have the following remote connection ... Continue running will cancel connection ", enter" Y "or" Y "

2) Log in to the domain by using the net USE command (the process of acquiring permissions) to achieve the purpose of the normal access domain.

NET use //192.168.54.x/Administrative Department/Administrative Department internal folder/user:jiesai/zhuyongfeng

Note: The space and slash requirements in the command

3) If you require a password, enter the domain login password.

***************************************************

Each of the above operation has 3 steps, more cumbersome, by making a ". BAT "file, we can make the above steps automatic execution.

The first step: Create a new text file, modify the prefix name, for example: Netemp.bat

Step two: Edit the Netemp.bat file with the following content:

@echo off

net use */delete/y

(/y: This parameter can omit the popup inquiry box, the system performs the "Y" option by default)

set/p netpath= Please enter the network address you want to access (format: //192.168.54.2/Information Center/Information Center internal files):

set/p username= Please enter the user name of the login domain:

set/p password= Please enter the password for the login domain:

(set/p paramter= parameter: The user input parameter is received in the bat file)

net use%netpath%/user:jiesai/%username%%password%

(% parameter%: Parse user input parameter format)

The Echo setting is complete, and you can access the domain directory normally.

Pause

Step three: Save the file and finish.

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.