Skip navigation

JSI Tip 0178 - Command line cut & paste.

CMD.exe supports command line cut and paste.

You can copy and paste text between MS-DOS and Windows NT. In the command prompt window, right-click anywhere on the title bar to see a menu, click Edit, and then click Mark. Select the text you want to copy and press ENTER to copy the text to the Clipboard or just right click again. You can then paste the text into your application.

Using the paste command, you can paste the Clipboard contents to the current command line. If you paste multiple lines of commands, they will all be executed in turn. Example:

dir c:\boot.ini
attrib -r -s -h c:\boot.ini
dir c:\boot.ini
attrib +r +s +h c:\boot.ini

Copy the above to the clipboard, open a cmd prompt, right click the title bar, click Edit, click Paste. The figure shows how each command was executed:

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish