在任务计划程序中运行的exe无法查看映射的网络驱动器 [英] Exe run in Task Scheduler cannot see mapped network drive

查看:860
本文介绍了在任务计划程序中运行的exe无法查看映射的网络驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题类似于此处发布的问题:

My problem is similar to the one posted here:

https://social.msdn.microsoft。 com /论坛/ SqlServer / en-US / bf5e65e5-fb92-40dc-9a98-77d87b19adc9 / when-using-task-scheduler-can-connect-to-shared-drive?forum = csharpgeneral& prof = required

https://social.msdn.microsoft.com/Forums/SqlServer/en-US/bf5e65e5-fb92-40dc-9a98-77d87b19adc9/when-using-task-scheduler-cannot-connect-to-shared-drive?forum=csharpgeneral&prof=required

我有一个简单的c#应用程序,用于检查网络共享上是否存在文件(我使用映射的字母E:,而不是完整路径,原因是技术原因不是一种选择)。

I have a simple c# application that checks if a file on a network share exists (I am using the mapped letter E:, not the full path, for technical reasons that is not an option).

当我通过双击它来运行这个控制台exe时,它可以工作,它说文件存在。

When I run this console exe by double-clicking on it, it works, it says the file exists.

如果我通过Task Scheduler运行这个exe(我将其设置为使用相同的帐户,最高权限运行,并运行用户是否登录),我被拒绝访问。

If I run this exe through Task Scheduler (I set it up to run with the same account, highest privileges, and run whether user is logged on or not), I get access denied.

这里发生了什么?

120811049008

120811049008

推荐答案

映射驱动器只能从用户界面访问我知道。当exe运行时,可能有一个脚本来映射驱动器,但最简单的解决方案是使用UNC路径。即形式:\\machinename\share
Mapped drives are only accessible from a user-interface as far as I am aware. There are probably workarounds with a script to map the drives when your exe runs, but the simplest solution would be to use UNC paths instead. i.e of the form: \\machinename\share


这篇关于在任务计划程序中运行的exe无法查看映射的网络驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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