Taiwan CSS Platform Team

Your Potential, Our Passion.

Windows 2008 / R2 排程執行bat檔時,出現錯誤代碼 0x1

Windows 2008 / R2 排程執行bat檔時,出現錯誤代碼 0x1

  • Comments 1
  • Likes

問題描述:

Windows 2008 / R2 直接執行bat檔可以正常執行,透過排程就無法執行,出現錯誤代碼 0x1

解決方法:

當您設定排程內容有以下類型時,

1. Win32 applications

2. Win16 applications

3. OS/2 applications

4. MS-DOS applications

5. batch files (*.bat)

6. command files (*.cmd),

 

建議您以下方式設定排程:

1. 以 [建立工作] [create task] (非精靈模式) 來建立排程工作。

2. 於 [一般] 標籤頁位置下方 [設定],設定以 “Windows Server 2003, Windows XP, or Windows 2000”  來執行。

此設置,主要是”向下相容” (Backward Compatible ),當您以此設定來執行task scheduler時,就會以task scheduler1.0模式來執行:

(這與目前2008 / R2的task scheduler 2.0 模式不同,詳細內容請參考下方說明)

clip_image002

3. 若是一般排程內容,你可以依照 [建立基本工作] (依照操作精靈指示) 逐步設定您需要的排程工作內容。

參考資料:

Task Scheduler Backward Compatible Tasks

http://technet.microsoft.com/en-us/library/dd315694(WS.10).aspx

A backward compatible task is a Task Scheduler 1.0 task that is used in the Windows XP, Windows Server 2003, and Windows 2000 operating systems. A Task Scheduler 1.0 task can be registered (scheduled) to execute any of the following application or file types: Win32 applications, Win16 applications, OS/2 applications, MS-DOS applications, batch files (*.bat), command files (*.cmd), or any properly registered file type.

You can register a Task Scheduler 1.0 task in one of three ways:

A. Use the schtasks.exe command-line tool to define and register a version 1.0 task.

B. Use Task Scheduler to define and register a task compatible with earlier operating systems. Click the Create Task action in Task Scheduler, set the Configure for box on the General tab to Windows Server 2003, Windows XP, or Windows 2000.

C.  Use Task Scheduler to import a Task Scheduler 1.0 task from an XML file.

Task Scheduler 2.0

http://msdn.microsoft.com/en-us/library/bb756979.aspx

Task Scheduler

http://msdn.microsoft.com/en-us/library/aa383614(VS.85).aspx

Comments
  • 在Windows 2008 標準版 (SP 2) 下

    以您說的方式改為

    設定“Windows Server 2003, Windows XP, or Windows 2000” 相容模式

    一樣跑不了批次檔

    .bat 與 .cmd 檔都實驗過了

    一樣都是"工作排程器已順利完成工作"但卻是傳回1?

    如果還有其他的解法

    煩請賜教

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment