Windows CMD Command Prompt Tricks and Hacks

Struggling with Windows CMD hacks & command prompt tricks?

Take Command is an interactive GUI and command line environment designed for developers, administrators, and advanced users to make the Windows command prompt easy to use and far more powerful. Take Command allows you to display Windows console applications in tabbed windows, with an optional Windows Explorer interface available for those times when you need a visual look at your folders and files. Windows batch scripting is much easier, more efficient, and vastly more powerful with the batch IDE and debugger. Take Command is a superset of the familiar CMD commands and syntax, so you're immediately more productive. (And your old command prompt tricks will still work while you learn Take Command's superior ones!)

Take Command includes hundreds of major enhancements to standard CMD commands such as COPY, DEL, DIR, and START, and adds 216 internal commands, more than 670 internal variables and functions, and thousands of other features.

 

Take Command Prompt Windows and Batch Files Introductory Video
 
Reverse Proxy plugin provided by Sites R Us (sitesrus.ca)

The default Windows shell CMD has always been pitifully limited in ability compared to the shells available in other operating systems such as Linux (which has bash, tcsh, zsh, etc.). And CMD hasn't improved significantly since its first appearance in Windows NT 3.1 (which was released in 1993). Because of the limitations in CMD, users have been forced to use the GUI for inappropriate tasks, or to write programs to perform tasks that the Windows shell should have been able to handle (either from the command line or in a batch file). Or worst of all, relying on undocumented behavior (or unpredictable bugs) in CMD to create convoluted command prompt tricks to do something that could be done in one or two lines with a less primitive scripting language.

You could spend hundreds of hours searching online for help on Windows command prompt tricks and CMD hacks. There are lots of articles and videos and you may even find a few CMD tricks for your tasks. But only after you have wasted most of those hours researching and sifting through the contradictory information, incompatibilities, and outright bugs to find a handful of useful command prompt tricks.

Ultimately what you're searching for is a way to make your life easier and your work a little less tedious and frustrating. Searching endlessly for Windows command prompt tricks ideas is one way to go – but the smarter way to go is by trusting our 20+ years of Windows scripting experience.

Take Command is our flagship product. For more than 28 years, JP Software has been helping programmers, system administrators, technical support professionals, and advanced users save time and money, ease frustration, control their system from the command prompt or GUI, and easily create powerful batch scripts. Take Command offers a new approach to working in Windows, bringing users the power of the command line and the ease of use of the Windows GUI. And Take Command is a complete CMD replacement that provides you with a vastly better UI and thousands of features that are not available with any amount of CMD prompt tricks (or even in those Linux shells).

Take Command supports those Windows CMD prompt tricks, but you don't need them -- Take Command can easily do in a line or two what takes dozens of lines (and a few external programs!) using CMD hacks. You don't need to resort to command prompt tricks when you have a real scripting language available!

Take Command has a rich development and operations environment that allows you to:

  • Combine the power of the command line with the ease of use of Windows Explorer. You can manipulate files at the command line and graphically see the results, and drag and drop files into tab windows, other applications, or the desktop.
  • Customize Take Command, including multiple themes, colors, menus, toolbars, status bars, and windows.
  • Run multiple console and GUI applications simultaneously in tabbed windows, including our own Take Command Console (TCC), CMD, PowerShell and bash. Take Command will display output from console applications much faster (up to 10x!) than running the applications in the standard Windows console.
  • The optional input window (with full undo/redo) allows you to create and edit commands before sending them to the active tabbed window (console or GUI).
  • The TCC scripting language is a massive superset of CMD, with more than 235 internal commands, 388 internal variable functions, and more than 280 system variables. Almost all of the CMD commands (e.g. DIR, COPY, DEL, START, etc.) are enhanced with hundreds of additional options. And TCC adds more than 190 new commands. Wouldn't you rather use an extensive scripting language that is clean, well-documented, and solid than those awful CMD tricks?
  • The scripting language includes a complete set of flow control structures including IF-Then-Else, DO and FOR loops, SWITCH, subroutines, batch libraries, etc.
  • Create your own internal user-defined functions by combining variables, functions, and commands.
  • Be immediately more productive with your interactive prompt and batch file programming tasks thanks to the integrated and familiar environment.
  • Reduce your learning and development time with the consistent command prompt syntax.
  • Use the programmable tabbed toolbar to create up to 20 tabs with up to 50 toolbar buttons on each. Toolbar buttons can start new tabs or stand-alone windows, or send commands or text to existing tabs.
  • Speed your development time and reduce syntax errors with the comprehensive help (including context-sensitive popup help for command syntax).
  • Create and debug your batch scripts in a fraction of the time with the integrated graphical IDE. The IDE includes tabbed edit windows and a sophisticated batch file debugger with syntax coloring, breakpoints, single stepping, tooltips, bookmarks, and tabbed watch and variable windows. Windows batch file development has never been easier or more powerful!
  • View your files with the built-in text and binary file viewer including scrolling, search, and print capabilities.
  • Browse command line and directory history, filename and directory completion, and use numerous cut and paste options (even with console applications that have no internal cut and paste support) with the advanced line editor.
  • Customize filename completion for any internal or external command or alias. This allows Take Command to intelligently select and display filenames based on the command you are entering.
  • Specify multiple filenames for most file processing commands (i.e., COPY, DEL, MOVE, etc.), or optionally the name of a file that contains the filename arguments. (COPY even supports multiple targets as well as multiple sources.)
  • Use multiple types of redirection, including redirecting and piping to STDERR, "here-document" and "here-string" redirection, and TEE and Y pipe fittings.
  • Environment variable handling is greatly enhanced, including nested variables, delayed expansion, multidimensional array variables and full access to the default, system, user, and volatile variables in the registry.
  • Customize your directory listings with PDIR (a programmable DIR replacement).
  • Colorize your command line output with the built-in ANSI x3.64 support.
  • Select or exclude files by date, time, size, and extended wildcards or regular expressions for extraordinary flexibility in file management.
  • Send keystrokes to Take Command windows or to other programs (console or GUI).
  • View your files with the built-in text and binary file viewer includes scrolling, search, and print capabilities.
  • Take Command includes internal compression and extraction commands for BZIP, GZIP, JAR, TAR, ZIP, and 7ZIP files.
  • Access FTP, TFTP and HTTP (including SSL and SSH) directories and files in all file-handling commands (COPY, DEL, MD, MOVE, RD, etc.).
  • Send SMTP, SMPP, and SNPP messages.
  • Navigate to any directory on your system by entering only part of its name with "fuzzy" directory searches.
  • Redefine your commands with aliasing, create new commands and functions for your regular tasks, and assign frequently used commands to a single keystroke.
  • Query WMI (Windows Management Interface) to retrieve system configuration information.
  • Monitor your system's hardware and software events, and execute tasks when an event is triggered. You can monitor directory and file changes, the clipboard, event logs, network connections, Windows services, processes, and USB and Firewire connections.
  • Create your own internal commands, variables, or key macros with plugins using C, C++, or Delphi, or take advantage of the many third-party plugins available for Take Command.
  • Internal support is included for any Active Scripting language. You can even combine multiple scripting languages in your Windows batch scripts.

How about a couple of examples?

(We'd like to show the CMD equivalent for these examples, but ... they can't be done with CMD!)


The following command will create a thread that waits for any file to be created or changed in the d:\results directory, and then copies them to a website:

  foldermonitor d:\results created modified forever (copy "%_folderfile1" "http://mycompany.com/results/")


The following batch file creates a web page (called status.html) and populates it with data about the status of the computer:

  type <<- EndHTML >! status.html
    <html>
    <head>
    <title>Server Status</title>
    </head>
    <body>
    <h2>Server Status</h2>
    <p>
    Total memory: %@comma[%@winmemory[5]] bytes<br>
    Memory available: %@comma[%@winmemory[6]] bytes<br>
    Memory load: %@winmemory[0] %%</p>
    <p>
    Free disk space on drive C: %@diskfree[c:,Mc] MB<br>
    Free disk space on drive D: %@diskfree[d:,Mc] MB</p>
    <p>
    Reported generated %_isodate %_time by  %@upper[%@filename[%_batchname]].</p>
    </body>
    </html>
  EndHTML

And this is what the script is doing:

1.<<- -- This creates a redirect that sends everything in the following lines up to EndHTML to the type command -- which creates a text output

2. >! -- Redirects the text output of the type command to a file called status.html. The ! after the redirection command (>) means that the system should overwrite any existing status.html file

3. HTML Code -- The next few lines are standard HTML code that sets up some static header text

4. System Data -- The next few lines gather data from the system. The parser will examine each line of code and do variable expansion. So, for example, %@winmemory[5] is a variable function that is evaluated as the actual amount of memory in the system. %@winmemory[0] is evaluated as the amount of memory (as a percentage) actually being used. You can nest functions, so %@comma[%@winmemory[5]] will apply the comma function to the amount of memory returned, properly formatting it.

You can then use the built-in FTP and/or HTTP support in the COPY command to upload it to your ftp or web site.

And here's what it looks like in your browser:

Server Status

Total memory: 8,796,092,891,136 bytes
Memory available: 8,795,884,236,800 bytes
Memory load: 63 %

Free disk space on drive C: 35,920 MB
Free disk space on drive D: 626,123 MB

Reported generated 2011-09-20 01:01:07 by TRICKS.CMD.


Does it all sound too good to be true? We invite you to download the fully-functional 30-day trial, or order risk-free with our unconditional 90-day money-back guarantee.

Learn more about CMD and Take Command.

Compare Take Command with other tabbed windows applications.

Learn more about our solutions for Windows Batch Scripting and Tabbed Windows Consoles


Take Command is compatible with any version of Windows 7, 2008R2, Windows 8, Server 2012, Windows 10, and Windows 2016.  Take Command includes both 32-bit and 64-bit versions, and requires a minimum of 60Mb of free disk space.