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.