Archive

Archive for the ‘Windows 7’ Category

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

Deleting the Windows.old directory and setup files after upgrading to Windows 8

  • Go to your Computer
  • Right click on C and select properties
  • Click on Disk Cleanup.
  • Click on Clean up system files. This will change the options in the ‘Files to delete:’ section.
  • Select ‘Older version of Windows’ option and press OK.
Categories: Windows, Windows 7, Windows 8

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

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

Disable or Stop Windows startup programs – speed up your system

Using a program’s own configuration options – Windows 7/Vista/XP/2K/NT/Me/9x

The best option is to check if a program gives you an option to disable the function you’re interested in – via a right-click on a System Tray icon or maybe an “options” menu within the program. If this isn’t available then you have to try something else.

For example, the popular Skype internet telephony/chat program can be disabled via Tools → Options → General Settings → deselect “Start Skype when I start Windows”.

Windows StartUp folder – Windows 7/Vista/XP/2K/NT/Me/9x

If you click on Start → All Programs → StartUp (Windows 7/Vista/XP) or Start → Programs → StartUp (Win9x/Me/NT/2K) you may find programs loading from here via shortcuts. If this is the case, you have two options :

  • Delete the shortcut from the StartUp directory (based on your OS):
    • Windows 7/Vista
      • C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup (Note – this directory is hidden by default)
      • C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    • XP/2K
      • C:\Documents and Settings\All Users\Start Menu\Programs\Startup
      • C:\Documents and Settings\<username>\Start Menu\Programs\Startup
    • NT
      • C:\Winnt\Profiles\All Users\Start Menu\Programs\Startup
      • C:\Winnt\Profiles\<username>\Start Menu\Programs\Startup
    • Win9x/Me
      • C:\Windows\Start Menu\Programs\Startup (single-user machine)
      • C:\Windows\Profiles\<user>\Start Menu\Programs\Startup (multi-user machine)
  • Create a temporary directory for your OS called “Disabled StartUp Programs” and move the shortcuts there. If a program doesn’t work as expected you can always move the relevant shortcut back again
    • Windows 7/Vista – C:\ProgramData\Microsoft\Windows\Start Menu\Programs
    • XP/2K – C:\Documents and Settings\All Users\Start Menu\Programs
    • NT – C:\Winnt\Profiles\All Users\Start Menu\Programs
    • Win9x/Me – C:\Windows\Start Menu\Programs

AutoRuns – Windows 7/Vista/XP/2K/NT/Me/9x

With the introduction of Windows 7, Microsoft recommends using AutoRuns for controlling which programs run when your computer starts. This utility can be downloaded from here. AutoRuns is a free utility developed by SysInternals and has now been taken under the Microsoft TechNet umbrella.

To use it to identify start-up programs do the following:

  1. AutoRuns requires no installation so move to the directory where it is located and Double-click on Autoruns.exe to run it.
  2. Select the Logon tab.
  3. Disable the startup programs.

MSConfig – Windows 7/Vista/XP/2K/Me/9x

You can also use the “System Configuration Utility” (referred to as MSConfig from now on) to identify startup programs. MSConfig is available for all Windows 7/Vista/XP/2K/Me/9x users (9x/2K users can use the respective versions from here).

  • Click Start and search for msconfig or click StartRun, type msconfig and then click on OK.

  • Select the Startup tab and disable the startup programs.

Registry Editor – Windows 7/Vista/XP/2K/NT/Me/9x

You can both disable and permanently stop programs from running during start-up by editing the relevant entries from the System Registry using the Registry Editor. This option isn’t for the faint hearted and should only be used by those who are comfortable with editing the System Registry and understand what implications any changes may have. If you delete something from the System Registry accidentally, it may be corrupted to the extent that Windows may not re-start at all so beware.

For information about the Windows registry and editing it’s contents try the Windows Guide Network registry pages.

  1. Click StartRun
  2. In the Open box type regedit and then click on OK or press Enter

The most common keys you’re interested in are as follows:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce

Occasionally the following keys will also be used – primarily by malware:

HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

In all cases:

HKLM refers to HKEY_LOCAL_MACHINE
HKCU refers to HKEY_CURRENT_USER

Categories: Windows 7

Reinstall Grub 2 after installing Windows 7 or reinstalling Windows Bootmanager (MBR)

An easy way is to use a Ubuntu livecd.

  • Boot Ubuntu 11.10 with the livecd
  • Start the disk utility with the command palimpsest to find the partition where Ubuntu was installed to. On my hard disk it was /dev/sda5.

  • Use your partition number instead of the 5…:
sudo -i
mount /dev/sda5 /mnt
grub-install --root-directory=/mnt/ /dev/sda
  • restart
Categories: Linux, Ubuntu, Windows 7