Archive
Loop through each line in a text file using a windows batch file
for /F "tokens=*" %%A in (myfile.txt) do ( echo %%A )
Windows cmd with history
PyCmd is a smart command prompt extension for Windows’ cmd.exe. Its purpose is to emulate a few power features of UNIX shells (decent Tab-completion, persistent history, etc.). You only have to download and unzip the package.
How to find open ports
The following command will show you which ports are open on your computer and what program hold the port:
netstat -anbo
With the following command you can search for an open port:
netstat -anbo|find "61616"
Display system information for Microsoft Windows
Displays complete system information for Microsoft Windows XP Professional or Windows 7 computers.
systeminfo[.exe] [/s Computer [/u Domain\User [/p Password]]] [/fo {TABLE|LIST|CSV}] [/nh]
systeminfo
How to get the directory structure of a drive or path
The tree command displays the directory structure of a drive or path graphically.
tree [drive:][path] [/F] [/A]
/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.
tree c: /F
The dir command allows you to see the available files in a directory.
dir [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
dir /s /b
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/
Edit Windows hosts (file)
For Windows NT, 2000 and above
%SystemRoot%\system32\drivers\etc\hosts
Registry key under \HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts
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.