back to basicsback to basics virendra yaduvanshi page 2 save a command's output to a file the...

19
Page 1 Back to Basics Virendra Yaduvanshi

Upload: others

Post on 08-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 1

Back to BasicsVirendra Yaduvanshi

Page 2: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 2

Save a Command's Output to a File

The use of redirection operators, specifically > and >> operators are

used to redirect the output of a command to a file, giving us a saved

version of whatever data the command produced in the Command

Prompt window.

Redirection Operator Explanation Example

>

The greater-than sign is used to send to a file,

or even a printer or other device, whatever

information from the command would have

been displayed in the Command Prompt

window had you not used the operator.

assoc > types.txt

>>

The double greater-than sign works just like the

single greater-than sign but the information is

appended to the end of the file instead of

overwriting it.

ipconfig >> netdata.txt

<

The less-than sign is used to read the input for

a command from a file instead of from the

keyboard.

sort < data.txt

|

The vertical pipe is used to read the output

from one command and use if for the input of

another.

dir | sort

Page 3: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 3

Copy command output to Windows clipboard

The clip command copies all output from a command to the Windows

Clipboard. You can then paste that output into to any Windows

application, such as into Windows Notepad or Microsoft Word.

command | clip

Copies the output from the specified command to the

Windows clipboard.

Example :

dir | clip Copies the directory listing that is output from the dir

command to the Windows Clipboard.

clip < filename

Copies the contents of the filename file to the Windows Clipboard.

Example :

CLIP < README.TXT Places a copy of the text from readme.txt on

to the Windows clipboard.

Page 4: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 4

Customize the Command Prompt Title Bar Text

The TITLE command Sets the windows title for the command prompt

window

TITLE string

The specified set as command prompt windows.

Example :

Title Virendra Yaduvanshi.

Page 5: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 5

Copy From the Command Prompt

Right-click anywhere in the Command Prompt window and choose

Mark. Now, highlight with left mouse button whatever like to copy.

Once selection is made, press Enter.

Now we can paste that information into any program.

Page 6: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 6

View a Drive/Directory's Entire Directory Structure

TREE command is used to graphically displays the folder structure of

a drive or path.

Page 7: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 7

Open the Command Prompt From Any Location

There's a super easy Command Prompt trick that will let open a

Command Prompt window from whatever folder we're viewing in

Windows.

All it is depend on navigate, in Windows, to the folder where we want

to start working from in the Command Prompt. Once there, hold down

Shift key while right-click anywhere in the folder. Once the menu pops

up, notice there is an entry that's not usually there: Open command

window here.

Page 8: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 8

Drag and Drop For Easy Path Name Entry

There's a Command Prompt trick that makes this much easier: drag

and drop.

Just navigate to the folder you want the path for in Windows Explorer.

Once there, drag the folder or file to the Command Prompt window

and let go. Like magic, the full path is inserted, saving you a

considerable amount of typing depending on the length and

complexity of the path name.

Page 9: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 9

Robust File Copy

Robocopy, or "Robust File Copy", is a command-line directory and/or

file replication command. Robocopy functionally replaces Xcopy, with

more options. It has been available as part of the Windows Resource

Kit starting with Windows NT 4.0, and was first introduced as a

standard feature in Windows Vista and Windows Server 2008. The

command is robocopy.

Page 10: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 10

View Your Computer's Important Network Information

Everything we want to know about our network connection is

available somewhere in the Control Panel in Windows, but it's much

easier to find, and much better organized, in the results from the

ipconfig command.

Page 11: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 11

Map a Local Folder Just Like a Network Drive

The subst command is used to map a local folder just like a Network

drive. Just execute the subst command, followed by the path of the

folder which need to appear as a drive. For example, let's say you

want your C:\Windows\Fonts folder to appear as the Q: drive. Just

execute subst q: c:\windows\fonts and you're set!

Page 12: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 12

Automatically Complete Commands with Tab Completion

Tab completion is another Command Prompt trick that can save you

lots of time, especially if your command has a file or folder name in it

that you're not completely sure of.

Page 13: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 13

Run Commands Simultaneously

We can put && between two commands and execute them one after

another. The command on the left will execute first followed by the

command on the right of the double ampersand.

Page 14: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 14

Change Windows Explorer's Starting Location

Right-click on the Windows Explorer icon in taskbar. Right click on it

and choose Properties.

Under "Target," change the path to the folder you want Windows

Explorer to display by default

Page 15: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 15

Backspace Key to Go Up

Windows Explorer in Windows XP allowed you to move up a folder

using the Backspace key. If you got used to that feature, you’re

probably frustrated that it was removed in Windows 7. The Backspace

key in Windows 7 moves you Back in the folder browsing history, not

to the parent folder of the current folder.

Page 16: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 16

Add Copy To / Move To to the Windows Explorer Right Click Menu

A hidden functionality in Windows allows you to right click on a file,

select Copy To Folder or Move To Folder, and the move to box will pop

up and let you choose a location to either copy or move the file or

folder to. The quick registry hack to get this working:-1) Go to HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers

Now you will double-click on the (Default) value and enter the following:

{C2FBB630-2971-11D1-A18C-00C04FD75D13}

For Move to - Now when you right click on a file or folder, you should see the following options:

{C2FBB631-2971-11D1-A18C-00C04FD75D13}

Page 17: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 17

Use check boxes to select multiple files

In order to select multiple files for an operation such as copying,

moving or deleting in Windows Explorer, you generally use the

keyboard and the mouse, Ctrl-clicking every file you want to select.

Steps are as below :

1. In Windows Explorer, click Organize, and then select "Folder and

search options."

2.Click the View tab

3. In Advanced Settings, scroll down and check the box next to "Use

check boxes to select items." Click OK.

Page 18: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 18

Launch taskbar apps without a mouse

Likewise, you can launch any program on the taskbar without the

mouse. Press the Windows key and the number that corresponds to

the position of the application on the taskbar -- for example, Windows

key-1 to launch the left-most application on the taskbar, Windows key-

2 to launch the second left-most application and so on.

Page 19: Back to BasicsBack to Basics Virendra Yaduvanshi Page 2 Save a Command's Output to a File The use of redirection operators, specifically > and >> operators are used to redirect the

Page 19

Filtering Folder Content Views

Moving your mouse over a Heading will display a drop-down arrow.

Clicking on the down arrow will display a set of filtering options (check

boxes) that can be set for viewing items in the column.