How can I mount a windows drive in Java?

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 [devicename | *] [\\computername\sharename[\volume] [password | *]] [/USER:[domainname\]username] [/USER:[dotted domain name\]username] [/USER:[username@dotted … Read more

Find UNC path of a network drive?

In Windows, if you have mapped network drives and you don’t know the UNC path for them, you can start a command prompt (Start → Run → cmd.exe) and use the net use command to list your mapped drives and their UNC paths: C:\>net use New connections will be remembered. Status Local Remote Network ——————————————————————————- … Read more

How to run batch file from network share without “UNC path are not supported” message?

PUSHD and POPD should help in your case. @echo off :: Create a temporary drive letter mapped to your UNC root location :: and effectively CD to that location pushd \\server\soft :: Do your work WP15\setup.exe robocopy.exe “WP15\Custom” /copyall “C:\Program Files (x86)\WP\Custom Templates” Regedit.exe /s WPX5\Custom\Migrate.reg :: Remove the temporary drive letter and return to … Read more

An attempt to attach an auto-named database for file ….database1.mdf failed

I had this problem also and it was a pain. I configured my connection string and managed to solve the problem. In the connection string I replaced the value |DataDirectory|\dbfilename.mdf for AttachDbFilename property, with the path to the file. |DataDirectory| can only be used if the database file is in the App_Data folder inside same … Read more

Firefox Links to local or network pages do not work

This is the default Firefox behavior designed for security .The assumption is probably that most web sites don’t know what and where are you local files (including UNC paths). This could be turned off in firefox: type “about:config” in the address bar and accept “i’ll be careful” find “security.checkloaduri” in older versions or “security.fileuri.strict_origin_policy” in … Read more

Linking a UNC / Network drive on an html page

To link to a UNC path from an HTML document, use file:///// (yes, that’s five slashes). file://///server/path/to/file.txt Note that this is most useful in IE and Outlook/Word. It won’t work in Chrome or Firefox, intentionally – the link will fail silently. Some words from the Mozilla team: For security purposes, Mozilla applications block links to … Read more

Map a network drive to be used by a service

Use this at your own risk. (I have tested it on XP and Server 2008 x64 R2) For this hack you will need SysinternalsSuite by Mark Russinovich: Step one: Open an elevated cmd.exe prompt (Run as administrator) Step two: Elevate again to root using PSExec.exe: Navigate to the folder containing SysinternalsSuite and execute the following … Read more