unc

How can I determine if a string is a local folder string or a network string?

允我心安 提交于 2020-01-13 08:01:09
问题 How can I determine in c# if a string is a local folder string or a network string besides regular expression? For example: I have a string which can be "c:\a" or "\\foldera\folderb" 回答1: new Uri(mypath).IsUnc 回答2: I think the full answer to this question is to include usage of the DriveInfo.DriveType property. public static bool IsNetworkPath(string path) { if (!path.StartsWith(@"/") && !path.StartsWith(@"\")) { string rootPath = System.IO.Path.GetPathRoot(path); // get drive's letter System

UNC-paths for read.csv in R

本小妞迷上赌 提交于 2020-01-07 05:01:23
问题 So I have a problem with UNC paths. According to other unc related topic, the correct form should be: source <- read.csv("\\\\W:\\Reports\\report.csv") but then I got the error message: Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file '\\W:\Reports\report.csv': Invalid argument As a user I have access to that very folder and file - I am positive about it. 回答1: You are not using UNC paths. A UNC path would be something

Access to a windows share through UNC path, before the session opening

陌路散爱 提交于 2020-01-06 14:18:11
问题 I've to do a windows service which starts before the user logon. It's also mean that this service has to do have its own username/password. So how can I open a network share remotly without being logged? I'm in a windows domain, and the goal is to use some configured credentials to access the remote files I need. Do you have an idea? I just can't find anything to access easily to the server Edit: I'm sorry I made a mistake, the client computer isn't in the domain, the server is :( 回答1: If you

Why doesn't my program recognize mapped UNC paths?

筅森魡賤 提交于 2020-01-03 12:31:09
问题 I have some problems writing to a mapped network drive (P:) in Windows 7 from my Delphi program. When I try, for example, ForceDirectories('P:\test\folder') , I get an error (path not found). I have tried typing in the UNC path in the code ( ForceDirectories('\\computername\share\test\folder') ) and that works. However, ExpandUNCFileName('P:\') does not seem to work; it returns 'P:\'. On Windows XP, ExpandUNCFileName('P:\') returns the UNC path. How do I get the UNC path in Delphi on Windows

How do I convert a path with a drive letter to a UNC path

旧巷老猫 提交于 2020-01-01 08:22:05
问题 How do I convert a path with a drive letter like W:\Path\Share to the equivalent unc path like \\server\Share\File in .Net? At the command prompt you can run net use and that will list the mappings. How do I get at that info in .Net? 回答1: You can use P/Invoke and call on a native function such as WNetGetUniversalName. 回答2: To get a list of the shared folders on the current machine in .NET you have to options: Querying the Win32_share WMI class using the classes in the System.Management

IIS 6 with wildcard mapping and UNC virtual directory problem

元气小坏坏 提交于 2020-01-01 07:03:29
问题 On our production servers (win 2003 with IIS6 and load balanced with an F5 BIGIP), we have a problem when introducing wildcardmapping on IIS6. We use .net Framework 3.5 SP1. The issue manifests itself as by the server only sometimes serving the images stored on a virtual directory pointing to a UNC path. Sometimes the images are displayed, and sometimes not. Removing the wildcard mapping solved this problem. I will need wildcard mapping on the server for future features, so any help/pointers

Get UNC path from a local path or mapped path

情到浓时终转凉″ 提交于 2019-12-30 18:29:50
问题 In Delphi there is a function ExpandUNCFileName that takes in a filename and converts it into the UNC equivalent. It expands mapped drives and skips local and already expanded locations. Samples C:\Folder\Text.txt -> C:\Folder\Text.txt L:\Folder\Sample.txt -> \\server\Folder1\Folder\Sample.txt Where L: is mapped to \\server\Folder1\ \\server\Folder\Sample.odf -> \server\Folder\Sample.odf Is there a simple way to do this in C# or will I have to use windows api call WNetGetConnection and then

UNC paths as current directories in batch file where admin rights are requested

ε祈祈猫儿з 提交于 2019-12-25 04:06:06
问题 I'm currently trying to write a batch files that automatically creates a folder structure including shortcuts. For creating the shortcuts I use "mklink" which requires administrator privileges. I have used the code on this site (http://winaero.com/blog/how-to-auto-elevate-a-batch-file-to-run-it-as-administrator/) for giving me these rights automatically. However, the code down below works perfectly fine when I run it locally on my machine, but when I put it on a server location where it is

ant: copy file from remote location on windows

岁酱吖の 提交于 2019-12-24 10:24:22
问题 I want to copy a file present in a shared location to windows machine. Is there some way by which i can specify username and password while copying the file? If i try to access using copy task, it is giving error saying location does not exist. is it because of permission? <copy todir="C:/localdir"> <fileset dir="\\\remotemachinename\dirname"> </fileset> </copy> 回答1: I think you may have the address wrong. I just tried the following tests successfully(2 slashes): dir="\\remotemachinename

Accessing files across the windows network with near MAX_PATH length

强颜欢笑 提交于 2019-12-23 20:15:06
问题 I'm using C++ and accessing a UNC path across the network. This path is slightly greater than MAX_PATH. So I cannot obtain a file handle. But if I run the program on the computer in question, the path is not greater than MAX_PATH. So I can get a file handle. If I rename the file to have less characters (minus length of computer name) I can access the file. Can this file be accessed across the network even know the computer name in the UNC path puts it over the MAX_PATH limit? 回答1: I recall