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 solve the problem that Windows 2008 Task Plan failed to execute bat script and returned 0x1

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly shows you how to solve the Windows 2008 task plan to implement bat script failure to return 0x1 problem, the content is easy to understand, I hope you can learn, after learning will certainly have a harvest, the following let the editor take you to take a look at it.

Test environment:

C:\ > systeminfo | findstr / c: "OS Name"

OS Name: Microsoft Windows Server 2008 R2 Enterprise

Many people encounter this problem when creating a task plan execution bat file in Windows 2008: the status code returned after the task plan execution is 0x1 instead of a normal 0x0

I was fooled by this problem today, and it took me almost a day to make mistakes. It's fine to execute bat scripts alone, and it's okay to execute bat scripts in the task plan of Windows 2003, but not as long as you put it in the task plan of Windows 2008. After a search on domestic and foreign websites, I finally put together all the points for attention. The steps are summarized as follows:

1. Make sure that the password of the user who wants to execute the task plan has not expired. If the condition permits, the password can be set to never expire, so as to avoid unnecessary trouble.

The Chinese system is an option that the password will never expire.

2. Open the task manager, right-click Task Scheduler Library, and select Create Task. Do not select Create Basic Task here.

3. Select Run whether user is logged on or not in the General tab, check Run with highest privileges, and then select Windows Server 2003 from the drop-down list. Do not select Windows Server 2008 here.

The Chinese system corresponds to the following figure

4. There is nothing special in the Triggers tab, just set the execution time according to your own needs.

5. In the Actions tab, enter the name of the script in the Program/script input box, and do not include the path here. Fill in the path where the script is located in the Start in input box, and do not put quotation marks here.

6. Add a line at the end of the bat script:

Click (here) to collapse or open

Exit / b 0

If you do not explicitly specify the exit code, the task plan will assume that the script execution failed.

Window server versions prior to 2012 do not need to set a path to execute scheduled tasks

After window server 2012, the path should be set for the execution of planned tasks.

The batch program runs normally by double clicking directly, but the error code 0x1 is missing when the scheduled task runs in windows.

Cause of error: batch scripts in programs and scripts have a directory structure, but start there without configuring the path to the directory where the batch script is located

The above is about how to solve the problem of 0x1 returned by the failure of bat script execution in Windows 2008 task planning. if you have learned knowledge or skills, you can share it for more people to see.

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

Servers

Wechat

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

12
Report