在 Windows server 2008 下计划任务无法正常执行bat批处理文件
2010-12-15 13:44
357 查看
转帖请注明出处!!! 原贴:/article/11819413.html
接上篇,批处理文件肯定是没有问题,加入到计划任务中,发现有能正常备份,但是没有办法拷贝到网络映射盘。将bat文件输出到文件,本想看看log的,结果居然没有正常执行。
google了一下,发现很多网友都有类似的问题,但没人给出答案。
很幸运的找到一篇微软官方论坛上的网友讨论的帖子,几乎全部解决我的问题。
http://social.technet.microsoft.com/Forums/en-US/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe/
很精彩的技术交流。
对我来说碰到了2个问题,
1, a.bat 是处理备份数据库,b.bat 内容为 a.bat > D:/abc/1.log , 将b.bat 加入的计划任务中,目的是想调试计划任务是否成功。(手动单独执行,每次都成功的)结果,是1.log不输出,计划任务中返回2;
2,a.bat 中有把备份好的数据拷贝到网络映射盘,比如Z盘,计划任务每次都不执行,手动运行该脚本也是好的。
按照上面论坛给的提示:
2) Make sure that the task is set to "start in" the folder that contains the batch file: open the task properties, click on the "actions" tab, click on the action and then the "edit" button at the bottom. In the "Edit Action" Window there is a field for
"start in (optional)" that you set to the path to the batch file.
在“操作”->"编辑操作"->“起始于(可选)" 中一定要填入 该批处理的路径。 这一招解决了第一个问题。
NET USE W: /DELETE
NET USE W: //myserver/myfolder /PERSISTENT:YES
这个是解决第二个问题的关键,在执行拷贝,或者建立新文件夹之前,先要进行如上两行命令。 细节:确保在我的电脑界面通过菜单操作的网络映射盘式断开的;Windows server 2008 用户管理页面有个网络密码管理,如果填写了,net use w: ... 这行命令就不需要输入密码和用户名。
这一招解决第二个问题。
完
2010-12-15
Windows server 2008 计划任务 bat 批处理 网络映射盘
补充一点:批处理文件中和 ”起始于(可选)“中的路径都不要使用 双引号""
接上篇,批处理文件肯定是没有问题,加入到计划任务中,发现有能正常备份,但是没有办法拷贝到网络映射盘。将bat文件输出到文件,本想看看log的,结果居然没有正常执行。
google了一下,发现很多网友都有类似的问题,但没人给出答案。
很幸运的找到一篇微软官方论坛上的网友讨论的帖子,几乎全部解决我的问题。
http://social.technet.microsoft.com/Forums/en-US/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe/
很精彩的技术交流。
对我来说碰到了2个问题,
1, a.bat 是处理备份数据库,b.bat 内容为 a.bat > D:/abc/1.log , 将b.bat 加入的计划任务中,目的是想调试计划任务是否成功。(手动单独执行,每次都成功的)结果,是1.log不输出,计划任务中返回2;
2,a.bat 中有把备份好的数据拷贝到网络映射盘,比如Z盘,计划任务每次都不执行,手动运行该脚本也是好的。
按照上面论坛给的提示:
2) Make sure that the task is set to "start in" the folder that contains the batch file: open the task properties, click on the "actions" tab, click on the action and then the "edit" button at the bottom. In the "Edit Action" Window there is a field for
"start in (optional)" that you set to the path to the batch file.
在“操作”->"编辑操作"->“起始于(可选)" 中一定要填入 该批处理的路径。 这一招解决了第一个问题。
NET USE W: /DELETE
NET USE W: //myserver/myfolder /PERSISTENT:YES
这个是解决第二个问题的关键,在执行拷贝,或者建立新文件夹之前,先要进行如上两行命令。 细节:确保在我的电脑界面通过菜单操作的网络映射盘式断开的;Windows server 2008 用户管理页面有个网络密码管理,如果填写了,net use w: ... 这行命令就不需要输入密码和用户名。
这一招解决第二个问题。
完
2010-12-15
Windows server 2008 计划任务 bat 批处理 网络映射盘
补充一点:批处理文件中和 ”起始于(可选)“中的路径都不要使用 双引号""
相关文章推荐
- 在 Windows server 2008 下计划任务无法正常执行bat批处理文件
- 在 Windows server 2008 下计划任务无法正常执行bat批处理文件
- 在Windows server 2008下计划任务无法正常执行bat批处理文件的问题
- 在Windows server 2008下计划任务无法正常执行bat批处理文件的问题
- [转载]在 Windows server 2008 下计划任务无法正常执
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008 计划任务配置(任务计划程序)每分钟执行BAT
- Windows Server 2008 任务计划无法自动运行的解决办法
- Windows Server 2008中使用计划任务定时执行BAT批处理文件图文教程
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008中使用计划任务定时执行BAT bat进行PHP脚本的执行
- 【定时任务|开机启动】Windows Server 2008/2012 计划任务配置(任务计划程序)每分钟执行BAT
- Windows Server 2008 计划任务配置(任务计划程序)每分钟执行BAT
- Windows Server 2008中使用计划任务定时执行BAT批处理文件图文教程
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008通过计划任务定时执行bat文件
- Windows Server 2008通过计划任务定时执行bat文件
- 关于window2008计划任务前台显示和批处理无法正常执行问题的解决办法