Archive

Archive for August, 2012

Substitute paths as virtual drives on Windows

With the subst command you can associate a path with a drive letter.

subst [drive1: [drive2:]path]
  • drive1:               Specifies a virtual drive you want to assign a path.
  • [drive2:]path     Specifies a physical drive and path you want to assign to a virtual drive.

Create new virtual drive

subst Z: "C:\Documents and Settings\All Users\Shared Documents"

Display a list of current virtual drives

subst

Delete a substituted (virtual) drive

subst Z: /d

Persistent Substituted Drives

Drive letters mapped in this way are not available during system startup for services nor do they persist across a reboot. To use persistent mapping you have to create a new registry entry or you can use psubst:
http://code.google.com/p/psubst/

Advertisements
Categories: Windows XP

Edit Windows hosts (file)

For Windows NT, 2000 and above

%SystemRoot%\system32\drivers\etc\hosts

Registry key under \HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts

Categories: Windows 7, Windows XP

Minimal Maven POM file

Minimum requirements for a POM:

  • project root
  • modelVersion – should be set to 4.0.0
  • groupId – the id of the project’s group.
  • artifactId – the id of the artifact (project)
  • version – the version of the artifact under the specified group
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>

Create a symlink / hard links with Windows 2000 and above

linkd

Download and install Windows Server 2003 Resource Kit Tools:

http://www.microsoft.com/en-us/download/details.aspx?id=17657

Create a symlink

linkd "c:\newdir" "c:\existingdir"

Check symlink

dir /al

Remove symlink

linkd "c:\newdir" /d

Junction

Download junction:
http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

Place the junction.exe file e.g. in your C:\WINDOWS\system32 directory so it would be on your system path.

Create a symlink

junction "c:\newdir" "c:\existingdir"

Check symlink

dir /al

Remove symlink

junction "c:\newdir" /d

Warning

Only the junction tool knows that these folders are actually symbolic links, the rest of the Windows file system thinks they are normal folders. For example you can delete a junction via Explorer and it will moved to your recycle bin and the folder that it points to stays where it was. But if you then empty your recycle bin it also empties the contents of the folder that this junction was pointing to! So always remember to use the junction command to create & delete junctions.

Junction Link Magic

Download Junction Link Magic:

http://rekenwonder.com/linkmagic.htm

Version 1 for Windows 2000/XP

Version 2 for Windows 2003/Vista/7

Junction Link Magic is a utility that lets you create junction points. Junction Link Magic automatically lists existing junction points, and it offers an easy interface to add, modify or remove junction points. Junction points can only be created on volumes formatted with NTFS 5.0 or higher.

Link Shell Extension

http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html

Link Shell Extension (LSE) provides for the creation of Hardlinks , Junctions , Volume Mountpoints , and Windows7’s Symbolic Links, (herein referred to collectively as Links) a folder cloning process that utilises Hardlinks or Symbolic Links and a copy process taking care of Junctions, Symbolic Links, and Hardlinks.

Categories: Windows 7, Windows XP

Copy and rename a file with Maven Antrun Plugin

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>com.test</groupId>
	<artifactId>copy-file</artifactId>
	<packaging>pom</packaging>
	<version>0.0.1-SNAPSHOT</version>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				<executions>
					<execution>
						<id>copy</id>
						<phase>validate</phase>
						<configuration>
							<target name="copy and rename file">
								<copy file="mySourceFile" tofile="MyDestFile" />
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

mvn validate