In the process of using the computer we will encounter a lot of problems, annoying ad Windows Non-stop pop-up, non-stop in multiple sets of network configuration switch; often forget the key data in the backup network; The encrypted folder cannot be opened due to misoperation. Have you ever thought that all these problems can be solved by a small file? You can even use it to solve almost every problem that you encounter when using a computer. It is a powerful bat file.
One, check leakage fill--to the system function add fire
Although our operating system is powerful, but there is still a lack of application in some aspects, such as: no timing shutdown software. BAT files can solve many of these problems.
1. Shutdown and reboot Let's start with a bat that lets the computer shut down at specified times of the day, as follows:
Open the Notepad in the attachment, write it inside, at 22:00 shutdown-s-F, select file → save, save type Select all files, and then name it: Shutdown.bat, as shown in Figure 1. If you want to shut down at 10 o'clock in the evening every day, drag the file to start → program → boot, so that every time the file will be executed, the specific meaning is, at 22:00 every day 10 o'clock, Shutdown-s-f shutdown and shut down all the unresponsive programs.
If you need to reboot the machine frequently, write a bat file for a quick shutdown, or open a notepad to write:
@echo off
Close command line display
%systemroot%\system32\shutdown-r-T 0
The-r parameter indicates the restart computer,-T indicates that the time followed by the wait seconds, and 0 means restart immediately.
2. Disk Finishing Windows XP's own Disk Defragmenter cannot be sorted out completely, we can write a whole bat, in Notepad, enter:
Defrag C:/f/v
Defrag D:/f/v
There are several partitions on which to write a few lines, where-F indicates that disk collation is mandatory even if there is not enough free disk space. -V indicates that the collation results are displayed.
Save this as a bat file, and then double-click it. If you think you've been sorting too long and you don't want to be around, you can enter the end of the file by typing: shutdown-s-F to finish shutting down.
second, all simple--let the network operation become easy
Conventional network operations, such as accessing shared folders, backing up network data, and switching network configuration, are time-consuming and laborious if used in traditional ways. With the bat file, everything will be simplified to a double-click action.
1. Backup Restore network Configuration For friends who often use laptops to surf the internet in both places, switching network configuration has become commonplace, and it's always time to go to the trouble of using bat files to make everything easier.
First select "Start → run", input: cmd, enter the command line interface after entering: NETSH-C interface Dump>d:\home.txt, enter the system will be your current network configuration backup to the D-disk home.txt document. Then start writing a bat file, only a simple line: Netsh-f D:\home.txt, Save as a bat file, and then double-click the file to apply the network configuration in Home.txt. If you think two files are annoying, you can also write two files as a bat file:
@echo off
netsh interface ip set address name= "Local Area 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, the subnet mask is: 255.255.255.0
netsh interface ip set address name= "Local Area Connection" gateway=110.10.10.2 gwmetric=0
Setting up Gateways
netsh interface ip set DNS name= "Local Area Connection" Source=static addr=10.10.10.3 register=primary
Setting up Primary DNS
netsh interface ip add DNS name= "Local Area Connection" addr=10.10.10.4
Set up Backup DNS
netsh interface ip set wins name= "Local Area Connection" Source=static Addr=none
Set wins
2. In the local area network mass information If the machine in your local area network does not prohibit Messenger Service (Enable method is: In "Run" Enter Services.msc, double click inside Messenger, choose to enable), when need to send a message to the whole network periodically, can be realized by batch processing file completely, realize method is:
REM prepares to release "9-point disconnection" to all computers on the LAN
Show before bat run, play a role in prompting
Pause
Suspend run, press any key to continue, if you need to run regularly, do not this paragraph
NET send * 9 dot break net
Send the "9 Point Break net" information, all the machines in the network segment, "*" means all the 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 network sharing on or off When you need to share a remote folder, always run to the local operation, if the number of large, it is possible to run broken legs, we can write an automatic sharing of the hard disk of the bat file to the user, as long as they double-click the file, you can achieve the purpose of sharing.
@echo off
Echo Regedit4>c:\1.reg
echo [HKEY_LOCAL_MACHINE \SOFTWARE \microsoft \ \CurrentVersion \network \lanman \e] >>c:\j.reg echo "Flags" =dword:00000102>>c:\j.reg
Flags are used to determine how shared directories are accessed, where the "Flags" =dword:00000102 is fully shared, 101 is read-only, and 103 is accessed by password.
echo "Parm1enc" =123:>>c:\1.reg
The Parm1enc key value holds the password in full access mode
echo "Parm2enc" =456:>>c:\1.reg
The Parm2enc key value holds the password in read-only access mode
echo "Path" = "D:\" >>c:\1.reg
Path key values are the paths of shared folders
echo "Remark" = "I shared your D-disk" >>c:\1.reg
Remark key value is a note
echo "Type" =dword:00000000>>c:\1.reg
regedit/s C:\j.reg DEL C:\j.reg CLS exit
Once the user has run this bat file, log off again 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 have the bat file to help you enter the password when you turn on, you will only need to double-click to open it. Input: NET use \\192.168.0.1\IPC$ "1234"/user: "Administrator, this means access to the PC 192.168.0.1 the top of the shared folder, the administrator user, the password is: 1234. Save it as a bat file and add it to the Startup group.
Improper sharing folder management, there will be serious security risks, so sometimes in order to secure, the need to bulk unload the shared folder, in fact, as long as the command: NET share C $/del added to the bat file, where C $ is the name of the shared folder, complete examples can be downloaded to xxxx.
4. Back Up network data
You can also use the bat file to back up the data to a local area network on a file server, which eliminates the problem of copying and pasting, in particular:
Set Source=e:\work
File source is the work folder on the native E disk
Set Dest=\\192.168.0.1\backup
The destination folder is a PC 192.168.0.1 backup folder
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 the file to complete the backup task.
third, impregnable--to make computer security more assured 1. Encrypt files with bat
Whether you use the encryption tool or the system's own EFS encryption, it becomes very difficult to recover the original file if you encounter a password loss or a certificate corruption, and encryption with a bat file is very simple.
The specific procedure is, first in the D disk set up a folder ABC, and then enter in the run: cmd back, open the command Line Editing window, and then enter:
C:\>documents and settings\administrator\cd\
C:\>d:
D:\>CD ABC
D:\ABC>MD 1..\
Set up the S. Catalogue under the ABC directory
Then create a bat file under the ABC directory, which reads:
Copy abc\* 1..\*
del/q abc\*
Save it as: Encrypt. bat and place it under the ABC directory. Then create a bat file that reads:
Copy 1..\* abc\*
Save it as: Decrypt. bat, as the name implies, you need to encrypt the file when you double-click the encryption. bat file, you need to decrypt when you double-click the decryption. bat file.
Let's take a look at the specifics of this encryption, where the "\" symbol in Windows represents the path separator, which distinguishes between the parent folder and the subfolder. Therefore, Windows cannot open a file or folder with the name "\", and the system prompts you for an error when you double-click such a file or folder, as shown in Figure 3. This type of folder is accessible in command-line mode. We created a folder in the ABC folder that could not be opened, and encrypted. bat copies the contents of the ABC folder to this special folder when encryption is required. Instead, copy them out to complete the decryption process. If the command: D:\ABC>MD 1..\, change to: D:\abc>md 1..\a, then 1. \ folder will not be visible.
2. Screen Taobao ads
Many annoying websites like to pop up a bunch of ads in our machine to increase their visibility, Taobao is one of them, its ads on your desktop unbridled pop-up, it is not safe, we can use bat file to disable it. For a Windows xp/2003 system, create a bat file for the operating system:
%SystemRoot% \system32 \notepad.exe C:\WINDOWS \system32 \drivers \etc \hosts
Kill Taobao
0.0.0.0 www.taobao.com
0.0.0.0 search.taobao.com
0.0.0.0 taobao.com
0.0.0.0 www.unionsky.cn
0.0.0.0 www.allyes.com
If the operating system is WINDOWS 98/me, replace the first row with the following:%SystemRoot%\system32\notepad.exe C:\WINDOWS\hosts, the bat file is to point to the Web pages related to Taobao to an empty IP, Is your machine can not access Taobao, you will not see its ads, hehe.
In fact, the bat file also has a lot of powerful functions, such as: Automatic installation software, operating system, anti-virus, bulk delete files. Because of the space limit here is not introduced. Finally, the bat file can also be used to optimize various services in the system, and the optimized file can be
Http://family1.chinaok.com/down/200602/datf.rar
Download.
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.