任务计划 - 访问非本地驱动器同时运行的任务尚未登录 [英] Task Scheduler - Access non-local drives while running task not logged in

查看:505
本文介绍了任务计划 - 访问非本地驱动器同时运行的任务尚未登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在赢调度运行每分钟的任务。该任务运行.bat文件这SVN更新了一系列的文件夹,然后执行一个Perl脚本(这反过来将运行,还有好几个)。输出/'登录'perl脚本(按日期/时间标记)被发送到共享驱动器,不是本地的机器上运行任务上。

I had a task in win scheduler that runs every minute. The task runs a .bat file which SVN updates a series of folders then executes a perl script (which in turn will run off several others). The output/'log' of the perl script (tagged by date/time) is sent to a shared drive, not local to the machine the task runs on.

整个任务完美的作品,直到日志发送到共享驱动器。由于任务需要每分钟运行一次我想这将是最好的使用设置'运行用户是否登录或不是的任务计划程序。一个框下面是详细的不存储密码。该任务将只能访问的本地的计算机资源。显然,这不会为我工作,所以我将其选中。

The whole task works flawlessly until sending the log to the shared drive. Since the task needs to run every minute I figured it would be best to use the setting 'Run whether user is logged on or not' in task scheduler.. A box beneath is detailed 'Do not store password. The task will only have access to local computer resources.' Obviously this is not going to work for me, so I left it unchecked.

但是剧本确实还没有登录的时候写的共享驱动器,甚至,有没有人对如何解决这个有什么建议?我也意识到我可以运行,只有当用户登录(这确实写的共享驱动器),但在这种情况下,我需要一个明确的方式,以确保该帐户的从不的注销,并不能强制注销由其他用户(计算机是由多个用户,最多每次两个共享)。

However the script does still not write to the shared drive, even when logged in. Does anyone have any suggestions on how to work around this? I also realised I could 'Run only when the user is logged in' (this DOES write to shared drive), but in that case I would need a definite way to ensure the account never logs off, and cannot be force logged off by other users (the computer is shared by a number of users, max two at a time).

思考?

推荐答案

phd443322 给已经正确的答案。

一个共享文件夹映射的驱动字母在Windows注册表中每用户帐户保存如果网络连接是使用默认设置进行。因此使用计算机的每个用户可以有不同的网络驱动器。

Mappings of a shared folders to drive letters are saved per user account in Windows registry if the network connection was made with default settings. Therefore every user using a computer can have different network drives.

还有就是选择的在重新连接的登录 的映射共享文件夹到驱动器号是默认勾选。但是,此选项可以创建连接到共享文件夹到驱动器盘符映射只为当前用户会话之前不被选中。

There is the option Reconnect at logon to map the shared folder to a drive letter which is by default checked. But this option can be unchecked before creating the connection to map the shared folder to a drive letter just for current user session.

NET USE /?此命令是用来共享文件夹映射到命令行驱动器号或批处理文件的命令提示符窗口输出的帮助下进入。还有就是选择 / persistent:{YES | NO} 即默认为。例如:

net use /? entered in a command prompt window outputs help of this command which is used to map a shared folder to a drive letter from command line or a batch file. There is the option /PERSISTENT:{YES | NO} whereby the default is YES. For example

net use Z: \\computer\share /persistent:no

连接一个共享文件夹为驱动器Z:仅用于当前用户会话

connects a shared folder as drive Z: for current user session only.

这解释了为什么 AMcNall 的,在自动化任务使用网络驱动器失败。

This explains why AMcNall's failed with using a network drive in automated task.

额外提示:

在使用这是在连接到公司网络的办公室中使用的笔记本电脑,但也在家中的专用网络或者没有网络,最后还经常在其它网络中,最好是避免由Windows自动网络驱动器连接在我的观点登录后。这是更好地使用位于硬盘上的某个地方批处理文件的快捷方式存储在与设置来运行最小化窗口的批处理文件属性的用户的Windows开始菜单文件夹中的启动此批处理文件。批处理文件包含例如:

On using a laptop which is used in the office connected to company network, but also at home in a private network or no network, and finally also often in other networks, it is advisable to avoid an automatic network drive connection by Windows after logon in my point of view. It is better to use a batch file located somewhere on hard disk with a shortcut to this batch file stored in folder Startup of the user's Windows start menu with the property set to run the batch file with minimized window. The batch file contains for example:

@echo off
echo Checking availability of server/computer XXX
%SystemRoot%\system32\ping.exe -n 1 XXX >nul
if errorlevel 1 goto EndBatch
echo Map shared folder XXX\share to drive letter Z:
%SystemRoot%\system32\net.exe use Z: \\XXX\share /persistent:no
:EndBatch

这篇关于任务计划 - 访问非本地驱动器同时运行的任务尚未登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆