Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, August 11, 2010

How to find files in Ms Windows using command line

dir c:\Local\Data\xxx\ /s /b | find "string"

Find
http://technet.microsoft.com/en-us/library/cc725655%28WS.10%29.aspx

Dir
http://technet.microsoft.com/en-us/library/cc755121%28WS.10%29.aspx

Examples

To display all lines from Pencil.ad that contain the string "Pencil Sharpener", type:

find "Pencil Sharpener" pencil.ad


To find a string that contains text within quotation marks, you must enclose the entire string in quotation marks. Then you must use two quotation marks for each quotation mark contained within the string. To find "The scientists labeled their paper "for discussion only." It is not a final report." in Report.doc, type:

find "The scientists labeled their paper ""for discussion only."" It is not a final report." report.doc


If you want to search for a set of files, you can use the find command within the for command. To search the current directory for files that have the extension .bat and that contain the string "PROMPT", type:

for %f in (*.bat) do find "PROMPT" %f 


To search your hard disk to find and display the file names on drive C that contain the string "CPU", use the pipe (|) to direct the output of the dir command to the find command as follows:

dir c:\ /s /b | find "CPU" 


Because find searches are case-sensitive and dir produces uppercase output, you must either type the string "CPU" in uppercase letters or use the /i command-line option with find.

Wednesday, July 28, 2010

Shorcut: Windows Explorer

explorer /e, C:\

You can use the following switches with the Explorer.exe command.

SwitchResult
/n Opens a new single-pane Window for the default selection.
This is usually the root of the drive on which Windows is installed.
/eStarts Windows Explorer using its default view.
/e, Starts Windows Explorer using its default view with the focus on the specified folder.
/root, Opens a window view of the specified object.
/select, Opens a window view with the specified folder, file or
program selected.

Examples

The following examples describe the use of Windows Explorer switches.
  • Explorer /n
    This command opens an Explorer window using the default setting. This is usually the root of the drive on which Windows is installed.
  • Explorer /e
    This command starts Windows Explorer using the default view.
  • Explorer /e,C:\Windows
    This command starts Windows Explorer using the default view, with the focus on C:\Windows.
  • Explorer /root, C:\Windows\Cursors
    This command starts Windows Explorer at the C:\Windows\Cursors folder. This example uses C:\Windows\Cursors as the "root" directory for Windows Explorer.

    NOTE: Note the comma after the "/root" switch in the command.
  • Explorer /select, C:\Windows\Cursors\banana.ani
    This command starts Windows Explorer with the "C:\Windows\Cursors\banana.ani" file selected.

    NOTE: Note the comma after the "/select" switch in the command.
The Windows Explorer switches can be combined in a single command. The following example shows the combination of the Windows Explorer command-line switches.
  • Explorer /root, \\server\share, select, Program.exe
    This command starts Windows Explorer using the remote share as its "root" folder, along with the Program.exe file selected.

Change the Windows Explorer Default Startup Folder

To change the default startup folder for Windows Explorer:
  1. Click Start, point to All Programs, point to Accessories, and then right-click Windows Explorer.
  2. On the menu that appears, click Properties.
  3. In the Target box, append the "/root" command-line switch to the "%SystemRoot%\Explorer.exe" command, using the startup location that you want. For example, if you want Windows Explorer to start at the root of drive C, edit the command to the following:
    %SystemRoot%\Explorer.exe /root, C:\
  4. Click OK.
Reference: How To Customize the Windows Explorer Views in Windows XP http://support.microsoft.com/kb/307856

Related post:

Related Posts with Thumbnails