Friday, January 29, 2010

Deleting files and folders using command line in windows xp


Since the command prompt is often used by systems administrators, many of the commands are specialized for networks and administration. However, the average PC user is not left out; there are some powerful commands for everyday tasks that anybody will find useful. Here we discuss some examples.
For convenience in the examples below, I will use simple names for files and folders without indicating the full path. Please remember that paths for all commands are relative to the folder indicated in the command prompt itself, unless explicitly indicated otherwise. The default reference folder is usually C:\Documents and Settings\(log on name)\. Thus if a reference is made to a file "somefile.txt", the computer assumes you mean C:\Documents and Settings\(log on name)\somefile.txt. If what you really want is C:\someotherfolder\somefile.txt, then you must enter the entire name with the correct path. Note that paths containing spaces have to be enclosed in quotes. A convenient way to be able to open the command prompt in a folder of your choice can be obtained by installing the Microsoft PowerToy “Command Prompt Here”. The right-click context menu will then contain an entry for opening a command prompt in any selected folder. The accessory can be downloaded here. Another way to get file names into the command line without having to type a long path is by using drag and drop. Open a command window and enter the command you want with a space after it. Then use Windows Explorer to open the folder containing the file you want to use. Drag the file over to the command window and drop it. (Drag and drop does not work in Vista.) 


Power deleting with the expanded "Del" command 

 

 

The delete command “del” now has a switch “/s” that provides for deletions in subfolders. Thus the commanddel /s myfolder\* will delete all files in myfolder and all files in any subfolders of myfolder. Note the convenient asterisk wildcard “*”, which allows for multiple deletions in a single user operation. Together with the switch “/s”, a single “del” command can clean out Temp folders and do other useful housekeeping chores. Another switch "/f" will force the deletion of read-only files. If you are sure about what is being deleted, add the “/q” switch to run in quiet mode so you aren’t asked if you really want to delete for every single file. Because of its power, this extended del command has to be used carefully. Any files deleted this way do not go into the Recycle Bin but are permanently removed.
To delete only files with a particular extension EXT, use the commanddel /s myfolder\*.ext Note that this command will delete all files of a particular type in a folder and all its subfolders. One example of its use is to get rid of all temporary files with the extension TMP. 


Enhanced management of folders (directories) 

 

 

The command "rmdir" or its twin "rd" are also expanded compared to the old DOS version. To remove folders (directories), use “rmdir” (just “rd” will also work). Folders must be empty before they can be deleted. However, there is a switch “/s” for deleting subfolders and with this switch files are also deleted. It is like the old command "deltree". The command rd /s myfolder will remove "myfolder" and everything in it. Adding the switch /q for a "quiet" mode is also possible.
Options have also been added to the command for making folders. The command “mkdir” or “md” can now make a whole tree. For example, consider the commandmd new\new1\new2 This will create a folder “new” with a subfolder “new1” that in turn has a subfolder “new2”. 


Xcopy- Powerful and versatile way to copy or back up files

 

 

For copying large numbers of files or backing up a large folder, the command line is often the fastest and easiest way to go. The command “xcopy” is a very useful and powerful command for this purpose. (The old DOS also had an “xcopy” command but it sometimes had trouble with long file names. The XP version has no such problems.) “xcopy” comes with an alphabet soup of assorted switches that give it great versatility for use as a file backup utility. Enter “xcopy /?” in a command prompt to see them all. For example with the switch “/d:[mm-dd-yyy]” only files changed after a given date are copied. A command that will copy all files from the folder myfolder that have changed since June 1, 2003 to the folder mybackup is given byxcopy myfolder mybackup /d:06-01-2003 If no date is specified the switch “/d” will copy all files that have changed at any time.As is true in general, if there are spaces in a name, the path and file name have to be enclosed in quotes. Adding the switch "/s" provides that subfolders and their contents will also be copied. Other switches provide for read-only and hidden files. Altogether, there are something like 27 command line options for xcopy. More information is on this page.


How to list files with "dir" 

 

 

The "dir" command is not new but it remains one of the most useful for average PC users. If you have ever wanted to make a list of all the files contained in a particular folder, you will have discovered that the Windows GUI provides no easy way to do this. It is very straightforward, however, when using the command line. The command “dir myfolder” will list the files and folders contained in myfolder. Again, there are switches that provide for various modifications of the command. For example “/h” will show hidden files and “/s” will list the contents of sub-folders in addition to those of the main folder. Of course, the normal output of the command is to the screen. To output to a file instead of the screen, the command isdir myfolder >listmyfolder.txt where “>” is the redirection symbol. The file "listmyfolder.txt" will be created by the command. Output can also be redirected straight to a printer on the LPT1 port but I think it is better to first create a file and then print from there if hardcopy is desired. These lists can be a lot longer than you might think. (These days most printers are on USB, anyway.) This use of dir is also available in Windows 98/Me.
The dir command can also be used to list only files with a given extension. For exampledir myfolder\*.doc /s >listmyfolder.txt will list all Microsoft Word files in myfolder and its subfolders. This form of the command will also list all the directories and sub-directories. If you want a list of filenames only, add the switch /b. The filename will include the full path. 


Renaming files with "ren" 

 

 

Renaming a a large number of files can be tedious. The command ren (also written rename) is somewhat limited but its ability to use wild cards can sometimes be useful. The basic command is ren file1 file2ren *.txt *.doc will rename all text files to have a DOC extension. The renamed file has to stay in the same folder as the original; this command cannot move files to another folder. The wildcard capability can be used to change the extension of all files of a certain type. Thus


Moving files

 

 

The command "move" takes a file from one folder and puts it in another. Its ability to use wild cards makes it useful for moving all the files of a given type to another location. A command of the typemove /y folder1\*.mp3 folder2\will move all MP3 files from folder1 to folder2. The switch " /y" is used if you want to prevent the system from asking if it should overwrite existing files of the same name. To prevent overwriting, use the switch "/-y".

Changing file attributes with "attrib"

In addition to their actual content, files also have a set of properties that characterize them (sometimes called metadata.) One set of these properties are the four attributes read-only, hidden, system, and archive. The archive attribute is primarily used in backup procedures but the other three can be encountered in various contexts. These attributes can be turned on or off with the command "attrib" and its switches. The great utility of this command is that it can act on subfolders with its switch "/s" and can use the wildcard "*". For example, to clear the read-only , system, and hidden attributes from a file use attrib -r -s -h somefile This operation is not uncommon when system files have to be edited. To restore the attributes the command is attrib +r +s +h somefile A common situation where it is desirable to clear the read-only attribute from many files is when files are copied from a CD. By default CD files are normally marked read-only. This can interfere with editing. To clear the read-only attribute from all files in a folder and its subfolders use attrib -r somefolder\*.* /s If you want to process all files of a certain type such as MP3, use attrib -r somefolder\*.mp3 /s

 

How to make your favorite folder easily accessible in Windows dialog boxes 

 

 

Another older command that I find handy is "subst". There are certain folders that I use over and over and I like to have ready access to them. One way to do this is to use the command “subst” to assign a drive letter to a folder. Since drives are at the top of My Computer and any folder trees in browse lists, it makes the folder very easy to get to. To map the “Z:” drive to a folder "myfolder", entersubst z: myfolder Unless you are working from the parent folder of "myfolder" you will need the full path for it. The assignment only lasts until the user logs off or the computer is shut down so I have a one-line batch file in my Startup folder that reinstitutes the assignment.


Other commands

 

 

There are so many commands that we can only give the briefest sketches here. A list of some that I think might be useful on home computers is given here. I urge you to look into as many as possible since I feel you will be surprised at how useful some can be. For example, there are a whole host of commands for checking network functions and for use on the Internet. (Many have names that begin with “net…”) There are new ones as well as versions of the well-known commands such as “ping” and “tracert”. As more and more people have home networks, these commands are assuming greater significance to the average PC user. Go to this page for more discussion of some networking commands.



Useful command line programs in scripts

 

 

Average PC users are not always comfortable using the command line and I have used VBScripts to wrap some of the examples discussed above with an easy-to-use graphical interface. Description of the free scripts and instructions for their use and downloading are at a sister site.

Thursday, January 28, 2010

How to Insert an Image Inline in Gmail

  • You can describe the look on your friend's face as she got your birthday present with words for paragraphs on end, but wouldn't it be nice to show a picture, too? Now that you have the image attached in Gmail, wouldn't it be even nicer to put that picture right in the body of your email alongside the imaginative description?


    Insert an Image Inline in Gmail

    To add an inline image to an email you are composing in Gmail:
     


  • Make sure rich text editing is turned on in the Gmail message you are composing and Insert images is enabled.

    • If you see a Rich formatting » link above your message's text editor, click it.
    • See below for turning on image insertion.


  • Position the text cursor where you want the image to appear.
  • Click the Insert Image button in the message's formatting toolbar.
  • To upload an image from your computer:

    • Make sure My Computer is selected.
    • Click Choose File and open the desired graphic.
    • You can click Choose File again to add another image while others are already uploading in the background.
    • Make sure the desired image is highlighted.


  • To use an image located on the web:

    • Make sure Web address (URL) is selected.
    • Enter the image's URL under Image URL.


  • Click Add Image.
Images you have uploaded from your computer remain available in the Insert Image dialog while you compose the message (but not for other emails).
After insertion, you can resize and move images easily.

Enable Image Insertion in Gmail

To turn on Gmail's Insert Image button:
  • Follow the Settings link in Gmail.
  • Go to the Labs tab.
  • Make sure Enable is selected for Inserting images.
  • Click Save Changes.

Insert an Image Inline in Gmail Without Insert images Enabled

To insert an image found on the web fast in any Gmail message:
  • Make sure the image is located at a web server.

    • That means you can open the image in your browser and have an address line that starts with "http".
    • You can upload the image to your web host or use a graphic you found on the web (which you can use without violating any terms).
    • If you don't have a web site, turn to a free image hosting service instead.
    • If the image is larger than some 640x640 pixels, consider shrinking it to more handy proportions before you put it online.


  • Locate the image on the web site or open it directly in your browser.

    • If the image appears on a page together with other items:
    • Click on the image with the right mouse button.
    • Select View Image from the menu.


  • Hit Ctrl-A (Windows, Linux) or Command-A to highlight the image.
  • Hit Ctrl-C (Windows, Linux) or Command-C.
  • Make sure rich text editing is turned on in the Gmail message you are composing.

    • If you can see a Rich formatting » link above the editing area, click it.


  • Position the cursor in the Gmail message where you want the image to appear.
  • Hit Ctrl-V (Windows, Linux) or Command-V.
  • If you use an image uploaded to a free image hosting service:

    • Click on the image.
    • Now click the Link button in the rich-text formatting toolbar.
    • Copy and paste the image's page address at the free image hosting service under To what URL should this link go?. If you uploaded the image to ImageShack, for example, you could link to "http://img.imageshack.us/my.php?image=example.jpg".
    • Click OK.


  • Continue composing the message.
If inserting an inline image does not work in your browser, try in Mozilla Firefox.

Wednesday, January 27, 2010

windows xp restarts after shutdown

Problem recognized: Wake on LAN

Right click "My Computer"
Select "Properties"
Go to "Hardware Device"
Click "Device Manager"
Select "Network Adapters"
Select .....PCI-Fast Ethernet Controller--> right click ---properties--->power management-->deselect "Allow the computer to turn off this device to save power"--->Go to "Advanced" tab--->put value off for "Wake from shut down" --->value none for "Wake up capabilities"
press OK


If this doesn't work then check your BIOS

Restart ---> press F2---> go to "Main" tab --->Network boot [Disable] --- Save

windows xp restarts after shutdown

Problem recognized: Wake on LAN

Right click "My Computer"
Select "Properties"
Go to "Hardware Device"
Click "Device Manager"
Select "Network Adapters"
Select .....PCI-Fast Ethernet Controller--> right click ---properties--->power management-->deselect "Allow the computer to turn off this device to save power"--->Go to "Advanced" tab--->put value off for "Wake from shut down" --->value none for "Wake up capabilities"
press OK


If this doesn't work then check your BIOS

Restart ---> press F2---> go to "Main" tab --->Network boot [Disable] --- Save

Windows XP restarts when attempting to shut down

Windows Computer restarts when attempting to shut down. When you shut down your Windows XP computer, does your computer restart instead of shutting down? Or does a Stop error may appear before the computer restarts? These problems are most likely caused by incompatible Roxio Easy CD Creator 5.0 or Direct CD 5.0 software or software drivers installed on your computer. In the following tutorial I'll cover the process of fixing the Windows XP reboot problem.

How to fix the Windows XP Reboot Problem:
One option is to completely remove Roxio Easy CD Creator or Direct CD.
However, in most cases the problem with with Windows XP rebooting instead of shutting completely down can be resolved by simply visiting the Roxio Website and proceeding to download and install an updated Easy CD Creator 5.0 driver for Windows XP.
If the problem is more complex and you are receiving a stop error message during boot, but the message disappears before you can write it down, you can try the following:
  1. Right click My Computer, and select Properties
  2. From the Advanced tab, under Startup and Recovery click Settings
  3. Under System failure, uncheck the Automatically restart box and click OK
Now the error message will remain on the screen and you can record the error information.
Additional Stop error information and help:
"Stop 0×0000000a(0×00000029,0×00000002,0×00000000,0×80466d7b" error message
If your getting this error message, you can try the following:
  1. First, uninstall the Easy CD Creator software
  2. Next click Start-> Run, type Regedit in the Open box, and click OK
  3. Find: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Security
    • Remove the Etetnt.mpd file that has a revision date of 1997
  4. Find: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
    • Remove Cdr4vsd, Cdralw2k, Cdr4_2k, Cdudf