SoFunction
Updated on 2025-04-13

Recommend a file to get all FAQs on the operating system page 2/3


2. Keep it simple - make network operation easier

If you use traditional practices, it is really time-consuming and labor-intensive to access common network operations such as shared folders, backup network data, and switch network configurations. With the bat file, everything will be simplified into a double-click action.

1. Backup and restore network configuration

For friends who often use laptops to surf the Internet in both places, switching network configuration has become commonplace. It is always troublesome to come and go. Using bat files can make everything simple.

First select "Start → Run", enter: cmd, enter the command line interface after pressing, and then enter: netsh -c interface dump>d:\. After pressing, the system will back up your current network configuration to the document on D disk.

Then start writing the bat file, with only one simple line: netsh -f d:\, save as a bat file, and then double-click the file to apply the network configuration in the file. If you feel annoyed with two files, you can also write the two files into a bat file:

@echo off 

netsh interface ip set address name="local connection" source=static addr=10.10.10.1 mask=255.255.255.0

//Set the IP address of the local connection to: 10.10.10.1, and the subnet mask is: 255.255.255.0

netsh interface ip set address name="local connection" gateway=110.10.10.2 gwmetric=0

//Set up the gateway
netsh interface ip set dns name="local connection" source=static addr=10.10.10.3 register=PRIMARY

//Set main dns

netsh interface ip add dns name="local connection" addr=10.10.10.4

//Set backup dns

netsh interface ip set wins name="local connection" source=static addr=none

//Set wins

2. Send messages in a group on the LAN

If the machine in your LAN does not prohibit messenger service (the enable method is: enter: in "Run" and double-click the Messenger inside and select Enable), when you need to send messages to the entire network regularly, you can use batch files to implement it. The implementation method is:

rem is ready to release "9 points off the network" to all computers in the LAN

//Show it before bat runs, plays a prompt function

pause 

//Pause the operation and press any key to continue. If you need to run regularly, don't do this section.

net send * 9 o'clock disconnection

//Send the message "9 points to disconnect the network", all machines in the network segment, "*" means all machines.

Save it as a bat file and double-click it to get the effect shown in Figure 2. Press any key on the keyboard and the information will be sent to the entire network. If you want it to be sent regularly, remove the pause field and add it to the scheduled task.

3. Turn on or off network sharing

When you need to share a remote folder, you have to run locally. If there are many, it may break your legs. We can write a bat file that automatically shares the hard disk and send the file to the user. As long as it double-clicks the file, it can achieve the purpose of sharing.

@echo off 

echo REGEDIT4>c:\ 

echo [HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\Windows\CurrentVersion\Network\LanMan\E]>>c:\ echo "Flags"=dword:00000102>>c:\ 

//Flags is used to determine the access method of shared directories, where "Flags"=dword:00000102 is fully shared, 101 is read-only, and 103 is accessed according to password.

echo "Parm1enc"=123:>>c:\ 

//Parm1enc key value saves the password under full access mode.

echo "Parm2enc"=456:>>c:\ 

//Parm2enc key value saves the password under read-only access mode.

echo "Path"="D:\">>c:\ 

//Path key is the path to the shared folder.

echo “Remark”="I shared your D drive">>c:\

//Remark key value is a note

echo "Type"=dword:00000000>>c:\ 

REGEDIT /S c:\ DEL c:\ cls exit 

After the user runs this bat file, log out and the folder will be shared. If you need to access a shared folder every day and the shared folder has a password, you can also ask the bat file to enter the password first when you boot up, and then you only need to double-click to open it when accessing. Enter: net use \\192.168.0.1\IPC$ "1234" /user:"administrator, this means accessing the shared folder on PC 192.168.0.1, use the administrator user, and the password is: 1234. Save it as a bat file and add it to the startup group.

Improper management of shared folders will cause serious security risks, so sometimes for security, it is necessary to batch uninstall shared folders. In fact, just add the command: net share c$ /del to the bat file, where c$ is the name of the shared folder. The complete example can be downloaded at XXXX.

4. Back up network data

You can also use the bat file to back up the data to a file server in the LAN, which saves the hassle of copying and pasting. The specific method is:

set source=e:\work 

//The file source is the work folder of the native e-disk

set dest=\\192.168.0.1\backup 

//The target folder is the backup folder of PC 192.168.0.1

net use \\192.168.0.1\IPC$ "1234" /user:"administrator" 

xcopy %source% %dest% /e /v /r /y /z 

//Copy the source disk file to the destination server

Save it as a bat file, and then just double-click this file to complete the backup task.

3. Solid as a stolen - Make computers safer and more reassuring

1. Encrypt files with bat

Whether using encryption tools or the EFS encryption that comes with the system, it becomes very difficult to restore the original file once the password is lost or the certificate is damaged. Encryption using bat files is very simple.

The specific operation steps are: first create a folder ABC in disk D, then enter: cmd and enter, open the command line editing window, and then enter:

C:\>Documents and Settings\Administrator\cd\ 

C:\>d: 

D:\>cd abc 

D:\abc>md 1..\ 

//Create the s. directory under the abc directory

Then create a bat file in the abc directory, with the content:

copy abc\* 1..\* 

del /q abc\* 

Save it as: Encrypted.bat and put it in the abc directory.

Then create a bat file with the content:

copy 1..\* abc\* 

Save it as: decrypted.bat, as the name implies, double-click to encrypt the .bat file when you need to encrypt the file, and double-click to decrypt the .bat file when you need to decrypt it.

Let's understand the specific principle of this encryption. In Windows, the "\" symbol represents the path separator, which is used to distinguish between parent folders and child folders. Therefore, Windows cannot open a file or folder with "\" in its name. When double-clicking such a file or folder, the system will prompt an error, as shown in Figure 3. This type of folder is accessible in command line mode. We create such an unopenable folder in the abc folder. When encryption is required, use encryption.bat to copy the contents in the abc folder to this special folder. On the contrary, copying it will complete the decryption work. If you change the command: D:\abc>md 1..\ to: D:\abc>md 1..\a, the 1..\ folder will not be visible.
Previous page123Next pageRead the full text