I tried with WMI but doesn't work.
I also tried this with LogonUser but it doesnt work because LogonUser only works for local computers.
So how can I copy a file or at least get connected to the computer so it accept System.IO.File.Copy?
If you need a share with that you can access on every computer, you can try \\\\computername\\c$
.
If your app has admin-rights, you can copy files to every location on the c:. Use \\\\computername\\d$
for d:
and so on.
Hope this helps.
You need to p/invoke WNetUseConnection to get access to the computer first, then use a UNC path to access the file and use normal file I/O. Here is some sample C# code .
You would for example access c:\\test.txt on a computer named MONKEY on your LAN via a path like this: @"\\\\MONKEY\\c$\\test.txt"
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.