unc

Find UNC path of a network drive?

自作多情 提交于 2019-11-27 17:09:00
I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are were the drive name comes to play. Question: Is there an easy way on a Windows 7 machine to find out what the full path of the UNC is for any specific drive location? Code: allowedWritePaths=Q:/A/B/C/D/E/ allowedReadPaths=C:/A/B;//itpr99999/c$/A/FileName.txt allowedDeletePaths=

What is the correct way to check if a path is an UNC path or a local path?

自古美人都是妖i 提交于 2019-11-27 15:43:48
问题 The easiest way to check if a path is an UNC path is of course to check if the first character in the full path is a letter or backslash. Is this a good solution or could there be problems with it? My specific problem is that I want to create an System.IO.DriveInfo-object if there is a drive letter in the path. 回答1: Since a path without two backslashes in the first and second positions is, by definiton, not a UNC path, this is a safe way to make this determination. A path with a drive letter

C#: How to logon to a share when using DirectoryInfo

家住魔仙堡 提交于 2019-11-27 14:07:02
If I want to instantiate a DirectoryInfo object with an UNC path DirectoryInfo myDI = new DirectoryInfo (@"\\server\share"); how can I pass a username / password that is required to access that share? Thanks In .NET 4 this class works perfectly for me to logon in none windows server via UNC. using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Web; using System.Runtime.InteropServices; using System.Security.Principal; using System.Web.Security; namespace

Mapped Network Drives

最后都变了- 提交于 2019-11-27 08:11:26
问题 I have mapped a network drive to a computer in my home network. Now I am trying to access it via PHP - I did this quick test: echo opendir('Z:\\'); This gives me: Warning: opendir(Z:\) [function.opendir]: failed to open dir: No error in C:\wamp\www\webs\tester-function.php on line 3 What have I done wrong here? I don't want my users typing in the UNC path so is there a way to get the UNC path for them and maybe that will work when I try to access it? This is possible in Microsoft languages

Cannot access network drive in PowerShell running as administrator

▼魔方 西西 提交于 2019-11-27 05:09:58
问题 I'm running PowerShell in a Windows 7 x64 virtual machine. I have a shared folder on the host mapped as a network drive (Z:). When I run PS normally I can access that drive just fine, but if I run it "as administrator" it tells me: Set-Location : Cannot find drive. A drive with the name 'Z' does not exist. At line:1 char:13 + Set-Location <<<< Z: + CategoryInfo : ObjectNotFound: (Z:String) [Set-Location], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell

Method to determine if path string is local or remote machine

大城市里の小女人 提交于 2019-11-27 04:12:13
What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server? It's possible to determine if a path string is UNC using the following: new Uri(path).IsUnc That works great for paths that start with C:\ or other drive letter, but what about paths like: \\machinename\sharename\directory \\10.12.34.56\sharename\directory ...where both refer to the local machine - these are UNC paths but are still local. Don't know if there's a more efficient way of doing this, but it seems to work for me: IPAddress[] host; IPAddress[] local;

How can I mount a windows drive in Java?

扶醉桌前 提交于 2019-11-27 01:29:30
We are working with some legacy code that accesses a shared drive by the letter (f:\ for example). Using the UNC notation is not an option. Our Java wrapper app will run as a service, and as the first step, I would like to map the drive explicitly in the code. Has anyone done this? Consider executing the DOS command that maps a network drive as in the following code: String command = "c:\\windows\\system32\\net.exe use f: \\\\machine\\share /user:user password"; Process p = Runtime.getRuntime().exec(command); ... See details on net use command: The syntax of this command is: NET USE

Find UNC path of a network drive?

别等时光非礼了梦想. 提交于 2019-11-26 22:31:18
问题 I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not sure what the semi-colon is for, but I think that the double slashes are were the drive name comes to play. Question: Is there an easy way on a Windows 7 machine to find out what the full path of the UNC is for any specific drive location? Code:

C#: How to logon to a share when using DirectoryInfo

血红的双手。 提交于 2019-11-26 22:23:38
问题 If I want to instantiate a DirectoryInfo object with an UNC path DirectoryInfo myDI = new DirectoryInfo (@"\\server\share"); how can I pass a username / password that is required to access that share? Thanks 回答1: In .NET 4 this class works perfectly for me to logon in none windows server via UNC. using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Web; using System

How to (quickly) check if UNC Path is available

雨燕双飞 提交于 2019-11-26 20:08:29
问题 How can I check if a UNC Path is available? I have the problem that the check takes about half a minute if the share is not available : var fi = new DirectoryInfo(@"\\hostname\samba-sharename\directory"); if (fi.Exists) //... Is there a faster way to check if a folder is available? I'm using Windows XP and C#. 回答1: How's this for a quick and dirty way to check - run the windows net use command and parse the output for the line with the network path of interest (e.g. \\vault2 ) and OK . Here's