Search notes:
cmd.exe: Built-in commands
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.
dpath
: to add a list of directories to be searched for files with
type
.
forfiles : recursively find files and execute commands.
rmdir
to remove directories
time
prints the current time and allows to enter a new one
type
displays the content of a file or files.
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 +,,
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
for
for /l
to create sequences of numbers.
forfiles
forfiles /s /p %cd%\..\.. /m *.bat /c "cmd /c echo file=@file, ext=@ext, path=@path, size=@fsize etc"
if
if
can be used to conditionally execute parts in a
batch file .
mode
@rem the width and height of the cmd.exe window
@rem can be changed with:
@mode 80,10
set
set /a
allows to evaluate a mathematical expression and assign it to a
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";
}
See also
The text output of commands entered in
cmd.exe
can be put into the clipboard by piping it into
clip.exe
:
ipconfig | clip