Windows automatic task schedule execution batch file (.bat) reports an error that the DNS server is not authoritative for the zone

This kind of error is really confusing. But in the process of solving the problem, a good idea was obtained.

When you encounter a relatively unfamiliar Windows problem, Baidu may contain less. At this time, you can go to the Microsoft forum to find solutions.


https://social.microsoft.com/Forums/zh-CN/home


The DNS server does not authoritatively report errors for the zone:

When I wrote the batch file with confidence and passed the test, I created a new task in the automatic task plan, but the task reported the error " DNS server is not authoritative for the zone ". At this time, I was completely confused. The reasons for collecting a large amount of information are as follows.


Briefly talk about the use of automatic task scheduling in windows.

When we create a new task, we need to set the above tabs of general, trigger, operation, condition, and settings according to our own needs and click OK to create a complete task. The most important of these tabs are triggers and operations.

Trigger: Here you can define the execution frequency of the task

Operation: Here is to specify the program you want to execute automatically.

When I want to execute a batch file, I put the path of the batch process here. At that time, I noticed the option "Start from" because it was marked as optional, so I didn't care too much. However, it was such a small detail that caused the mission to fail.

Because every time I test a .bat script, I always subconsciously open the cmd window in the directory where the script is located, or switch to the directory where the script is located and execute it. That's because the .bat script has its own context when it is executed. The automatic task plan will not switch directories for you. If your .bat script does not support automatic switching to the current directory, then you need to set this "start in" option to the path of the directory where the script is located . Therefore, the optional prerequisite for other people's annotations is that your script supports automatic directory switching.


Guess you like

Origin blog.csdn.net/wang740209668/article/details/78959953