需要以编程方式编辑远程计算机上的文件
我需要能够在没有包含共享文件的目录的情况下完成此操作。
我的应用程序的凭据是例如通过 RDP 登录时对该文件具有写入权限的用户的凭据,但是当尝试在代码中执行相同操作时,如何/在哪里输入这些凭据?
I need to be able to do it without the directory containing the file being shared .
The credentials of my application are of a user who has write permissions on that file when logging in via RDP for instance, but how/where can I input these credentials when trying to do the same in code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用“隐藏”
$
共享来编辑文件。因此,如果(例如)文件位于c:\somedir\myfile.txt
并且机器名为mymachine
,则文件的路径应为:替换
C$
和D$
用于D:
驱动器等...请注意,这些共享可能会被禁用,并且可能需要与共享所需的权限不同的权限。不过,RDP 会话值得一试。
You could try editing the file using the "hidden"
$
shares. So if (for example) the file is located atc:\somedir\myfile.txt
and the machine is calledmymachine
the path to the file should be:Replace
C$
withD$
for theD:
drive etc...Note that these shares may be disabled and may require different permissions from those needed for a RDP session, howevers its worth a try.
除非远程计算机上正在执行共享或某些服务可以为您提供数据(例如FTP),否则该文件根本无法从外部访问。
有提到的隐藏共享,这非常值得您在紧要关头尝试,尽管这并不能特别解决如何访问文件的确切问题“没有包含共享文件的目录 ”。
Unless there's a share or some service that is executing on the remote machine that can serve you the data (e.g. FTP) then that file is simply not going to be externally accessible.
There are the hidden shares as mentioned, which is well worth you trying in a pinch, though that doesn't particular solve the exact problem of how to access a file "without the directory containing the file being shared".