Use the NET command to make local area network file batch processing

xiaoxiao2021-03-06  62

Bamboo

Now everyone wants some synchronous software to reach the network directory or file update to reduce their workload. Now there are many software on the network to achieve this purpose, like synchronous experts, but these software requires the server and customers. End, clients have to be used, and take up a certain resource. This batch uses the net command to update the file and directory. The advantage is that any machine can do server and client, and do not occupy any resource Of course, the disadvantage is that writing batch processing is a bit annoying ^^.

I first wrote a batch process, then make a detailed explanation: Net Use s: // computer-01 / d attrib -s -h -r s: / ghostc: /windows/command/xcopy.exe / s / e / y D: / ghost s: / ghostnet us * / delete

Net use s: // computer-02 / d attrib -s -h -r s: / ghostc: /windows/command/xcopy.exe / s: / y d: / ghost s: / ghostnet us * / delete

Write a look at the use of the net command, here uses one of the parameters NET USE, if you are interested, can you play NET /? Show its HELP screen. Parameter NET USE: Connect your computer or disconnect the computer and shared resources, or display the connection information of your computer. Command format: NET Use [DeviceName | *] [ComputerNameshaseame [Volume]] [Password | *]] [/ user: [domainname] username] [[/ delete] | [/ personistent: {yes | no}]] parameter introduction : Type NET Use of NET Use without parameters to list network connections. DeviceName Specifies the name of the resource to be connected or the device name to be disconnected. The name of the ComputerNameShareName server and shared resources. Password Access the password for shared resources. * Tip Type password. / User specifies another user that is connected. DomainName Specifies another domain. UserName Specifies the username of the login. / HOME connects the user to its host directory. / DELETE Cancels the specified network connection. / Persistent controls the use of permanent network connection. The following is a simple example: (1) NET USE E: YFANGTEMP Set the YfangTemp directory to E: NET USE E: YFANGTEMP / DELETE disconnected connection

Here I only write two lines of batch, using these two big line network identity, others can be pushed in order. My Internet cafe network logo is Computer-01 ~ Computer-n is also the network name of Internet cafes, and can be changed according to its actual situation. Such as USER01 ~ Userxx

Start explaining each line command, the actual application is explained later. One. Command analysis. 1.Net use s: // computer-01 / d (Network connection to the Computer-01 shared disk D disk, and map into the network driving disk S disk. Here D disk is fully shared, if not full sharing file Copying, don't play a knife to chase me ^^. Tip 1: If you are afraid that the full share is deleted, you can set a full sharing password. Suppose the remote shared disk completely shared the password 123, then this line command is changed As follows: Net Use s: // computer-01 / d 123. This is no problem so that the remote client sharing disk is no problem. Tip 2: Why do you choose a D disk instead of the E disk C disk, it is a service to update and The machine's drive letter corresponds, I want to copy something under the local machine D. Of course, I have to correspond to the D disk.) 2. Attrib-s -h -r s: / ghost / (Target Directory to copy under the target The next file attribute (read-only, hidden, system) is removed. Tip: If the target disk does not have a ghost directory Next XCopy command will be created automatically)

3. C: /Windows/command/xcopy.exe / y / s / e d: / ghost s: / ghost / (copy the file under the ghost directory under the D Online of the local machine to the virtual map disk under the ghost directory The S disk here is a D disk on Computer-01. Tip 1: The S disk will automatically disappear after performing the first big line, when executing the second largest line, the D disk of Computer-02 is virtually mapped into a S disk; Tip 2: / S / E Parameter Meaning Refers to all subdirectories in GHOST include all the empty directories all copied ./y automatic overlay existing files)

4. NET USE * / Delete (disconnected all connections)

2. Actual application 1. The shared disk directory update: Compared to the legend of headache, I am unified installed in the mir directory under Netgames of the D disk. Use the D disk to share and set the shared password to ****. When you want to update files and plug-in files, plug-in files are placed under the mir directory. This first calls a computer and then writes the following command and execute it. Net use s: // computer-01 / d **** attrib--h -r s: / netgames / mirc: /windows/command/xcopy.exe d: / netgames / mir s: / netgames / mirnet us * / delete

Tip: 1. There is no use / s / e is only copying the file under the MIR root instead of copying the entire directory 2. We can also insert a C: / Windows / Command / DEL / Y S: / Netgames / mir / * before Xcopy. * Remove the files under MIR and then copy. Insurance is not written. 3.//computer-01 can be subprinched in order, such as computer-02 -03 -04.....

2. Updating the shared directory The above will update the files and plugins in the legendary directory, but there is a problem. The desktop icon of the network management software did not update synchronous update, good things, last time we have a full share of the entire disc character, this time we only share a directory and set the password ****. Because I use the Pubwin4 network management software, install the C drive, for security, or only share folders, not the entire disc. Pubwin's desktop shortcut is installed under HitSoft's Hitsoft's program files of the C disk, and the HitSoft is fully shared, the legendary and legendary plus shortcuts are placed under Netgames under the directory. Batch processing is as follows

Net use s: // computer-01 / hitsoft **** Attrib- ,h -r s: / netgamesc: / windows/command/xcopy.exe C: / Program ~ 1 / Hitsoft / Netgames S: / Netgames / S / Y / ENET USE * / Delete Tip: We can do more, and delete the directory, just convert Xcopy into deltree.

转载请注明原文地址:https://www.9cbs.com/read-84284.html

New Post(0)