Search notes:

cmd.exe: Built-in commands

assoc
cls to clear the console.
copy to copy files from one directory to another
date prints the current date and allows to enter a new one
del deletes one or more files.
dir
dpath: to add a list of directories to be searched for files with type.
echo to print text (information, warnings etc.) from a batch file.
ftype
forfiles: recursively find files and execute commands.
mklink is used to create symbolic links
pushd and popd.
shift
rem to comment a line (for example in a batch file).
rmdir to remove directories
start to run another process or command.
time prints the current time and allows to enter a new one
type displays the content of a file or files.
ver to display the Windows version
vol to display disk volume labels and serial numbers.

copy

Updating a file's timestamp

The following command updates a file's timestamp, much as touch on Unix does. However, it won't create the file if it does not exist.
c:\> copy someFile.txt +,,

echo

See here.

exit

exit quits cmd.exe or terminates a batch file, see here.

fc

@rem
@rem  Compare files, but do not print anything
@rem  if files are equal
@rem
@rem  See http://superuser.com/a/991129/16610
@rem

@fc   %1 %2 > %temp%\fc.out || cat %temp%\fc.out
Github repository about-cmd.exe, path: /commands/fc/print-nothing-if-equal.bat

for

for /l to create sequences of numbers.
for /f

forfiles

forfiles /s /p %cd%\..\.. /m *.bat  /c "cmd /c echo file=@file, ext=@ext, path=@path, size=@fsize etc"
Github repository about-cmd.exe, path: /commands/forfiles/p-m-c.bat

if

if can be used to conditionally execute parts in a batch file.

goto

goto has gone here.

mode

@rem  the width and height of the cmd.exe window
@rem  can be changed with:

@mode 80,10
Github repository about-cmd.exe, path: /commands/mode/changeWidthAndHeight.bat

schtasks

schtasks.exe can be used to schedule tasks.

set

set /a allows to evaluate a mathematical expression and assign it to a variable.
set /p to get input from a user and assign it to an environment variable.

setlocal

setlocal localizes changes that are made to the environment.

Misc

#
#  Are environment variables expanded?
#
#  What happens with quoted strings?
#
#  Etc
#
#  call
#
#    what_does_cmd_pass_to_script.pl  %TEMP% "foo bar" ^abe ^^cde x'fo
#

use warnings; use strict;

print "\n";

for my $argv (@ARGV) {

  print "$argv\n";

}
Github repository about-cmd.exe, path: /misc/what-does-cmd-pass-to-script.pl

See also

cmd.exe
The text output of commands entered in cmd.exe can be put into the clipboard by piping it into clip.exe:
ipconfig | clip

Index