Command Line Interface Flashcards
Set Command
view all env variables in command shell
Where Command
find executables within the PATH variable
Echo Command
repeat things
Dir Command
look at folder contents
Type Command
output contents of a file
Findstr Command
Windows grep
Hostname
system hostname
date /t
output system date (/t keeps it from trying to set)
time /t
output system time (/t keeps it from trying to set)
>
redirect STDOUT. Create/overwrite
> >
redirect STDOUT. Create/append
|
Piping sends output of one command to input of another
& and ;
execute second command regardless of success/failure of first
&&
execute second command ONLY if the first is successful
||
execute second commmand ONLY if the first fails
( )
nest commands for complex arrangement
echo “Text Here”
prints “Text Here”
echo
shows if echo is on or off
echo .
print a blank line
( )
nest commands for complex arrangement
echo “Text Here”
prints “Text Here”
echo A=%A%
prints the new variable
echo .
print a blank line
@echo off
the @ suppresses display of the line in a batch file
set A=4
defines a new variable
set A=%A%
prints the new variable
echo “A=%A%”
spaces are retained, as are quotes
echo %COMPUTERNAME%
built-in environment variable - prints the computername
where
find executaables within the PATH variable; are commands native to CMD
where dir
internal to CMD
where where
built into windows - tells you where the “where” command is located.
dir
current directory
dir .
current directory also
dir ..
parent directory
dir c:\
specific directory (absolute path)
dir /b
/b for bare, just show filenames
dir /s
/s subdirectories, recursive
dir /a:h
show hidden files
echo Hello > hello.txt
create a file
echo There»_space; hello.txt
append to the file, create if needed
type hello.txt
prints the file stated with the command
type
print a file, usually to the screen
date / time
commands to view/set date and time
findstr
find a substring