Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Net command to update LAN files synchronously in batches

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to use the Net command to synchronize the update of LAN files in batches". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use Net commands to update LAN files synchronously in batches".

The code is as follows:

Net use S: computer-01D

Attrib-s-h-r S:ghostC:WINDOWSCOMMANDXcopy.exe / s / e / y

D:ghost S:ghost

Net use * / delete

Net use S: computer-02D

Attrib-s-h-r S:ghost

C:WINDOWSCOMMANDXcopy.exe / s / e / y D:ghost S:ghost

Net use * / delete

Write and explain the use of the net command. Here, one of the parameters net use of the net command is used. If you are interested in something else, you can type net/? in the command window. Displays its help screen.

Parameter net use

Function: connect the computer or disconnect the computer from shared resources, or display the connection information of the computer.

Command format: net use [devicename | *] [computernamesharename]

[password | *]] [/ user: [domainname] username] [[/ delete] |

[/ persistent: {yes | no}]]

Parameter description:

Type net use with no parameters to list the network connections.

Devicename specifies the name of the resource to connect to or the name of the device to disconnect.

The name of the computernamesharename server and shared resource.

The password for password to access the shared resource.

* prompt for a password.

/ user specifies another user to connect to.

Domainname specifies another domain.

Username specifies the user name of the login.

/ home connects the user to its host directory.

/ delete cancels the specified network connection.

/ persistent controls the use of permanent network connections.

The following is a simple example:

(1) net use e: YFANGTEMP establishes the YFANGTEMP directory as the E disk

(2) net use e: YFANGTEMP / delete disconnect

Here I only write two lines of batch processing, the intention of these two lines of network identity is different, the other can be in turn and so on. My Internet bar network logo is computer-01~computer-N.

That is, the network name of the computer in the Internet bar can be changed according to its own actual situation. For example, user01~userXX

Start explaining each line of command, and the actual application will be explained later.

One. Command parsing.

1.net use S: computer-01D

(the shared disk d disk of computer-01 is connected to the network and mapped to the network drive disk s disk. Here the d disk should be fully shared, and if the file is not fully shared, it will not be possible to copy it.

Tip 1: if you are afraid that a full share will be deleted, you can set a full sharing password. Assuming that the full sharing password of the remote shared disk is 123, the command should be changed as follows:

Net use S: computer-01D 123

In this way, there is no problem accessing the shared disk of the remote client. Tip 2: why do you choose d disk instead of e disk c? it corresponds to the drive letter of the synchronized updated server. I want to copy what is under the local d disk, which, of course, corresponds to the d disk. )

2. Attrib-s-h-r S:ghost

(remove the file attributes (read-only, hidden, system) under the target directory to be copied on the target disk. Tip: if the target disk does not have a ghost directory, the next xcopy command will be created automatically)

3. C:WINDOWSCOMMANDXcopy.exe / y / s / e D:ghost

S:ghost (copy the files under the ghost directory under the local d disk to the ghost directory under the virtual mapping disk s disk, where the s disk is the d disk on computer-01. Hint 1: s disk will disappear automatically after the execution of the first line, and when the second row is executed, the d disk of computer-02 is virtually mapped to s disk; hint 2 is that the parameter s / e means that all subdirectories under ghost, including empty directories, are copied. / y automatically overwrite existing files)

4. Net use * / delete (disconnect all connections)

two。 Practical application

1. Updates to the shared disk directory:

For example, the legend of headache, I installed it in the mir directory under the netgames of the d disk. Fully share the d disk and set the sharing password to *. When you want to update files and plug-in files, plug-in files are also placed in the mir directory. In this way, debug a computer and then write the following command and execute it.

Net use S: computer-01D *

Attrib-s-h-r S:netgamesmir

C:WINDOWSCOMMANDXcopy.exe D:netgamesmir S:netgamesmir

Net use * / delete

Tip:

1. There is no use / splink here, that is, only the files in the root directory of mir are copied, not the whole directory

2. We can also insert a sentence C:WINDOWSCOMMANDdel / y Spurnetgamesmirrors before xcopy. *

Delete the files under mir and then copy them. You don't have to write it just to be on the safe side.

3.computer-01 can be written in turn, such as computer-02-03-04. . . . .

two。 Updates to shared directories

After updating the files and plug-ins in the legendary directory above, there is a problem. The desktop icon of the network management software is not updated synchronously, so it is a good thing to do in the end. last time, we completely shared the entire drive letter, this time we only shared a directory and set the password *. Because I use pubwin4 network management software, install C disk, for security reasons, only share folders, not the whole disk. Pubwin desktop shortcuts are installed under the hitsoft of program files on disk C, hitsoft can be fully shared, and legendary and legendary plug-ins are placed under netgames in the directory. The batch processing is as follows

Net use S: computer-01hitsoft *

Attrib-s-h-r S:netgames

C:WINDOWSCOMMANDXcopy.exe c:program~1hitsoftnetgames

S:netgames / s / y / e

Net use * / delete

Tip: we can do more, and delete directories, as long as we convert xcopy to deltree.

Thank you for your reading, the above is the content of "how to use Net command to make LAN file batch synchronous update". After the study of this article, I believe you have a deeper understanding of how to use Net command to make LAN file batch synchronous update. The specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report