1. Interactive with shell
1.1 run programs, scripts and existing tools
format:
# method 1: with path and programnaem
& 'c:\program files\program\program.exe' arguments #arguments can omit
# method 2: in local path
.\program.exe arguments.exe arguments #arguments can omit
#methods 3: program name include space
& '.\program with space.exe' arguments #arguments can omit
&
in this place means invoke operator(调用操作符)
.\
in this place means current directory
quotes(") used in powershell
as shown previously, if you want to run a program in shell you must add&
in the front of this string
" "
will made program.exe as a string not a cmd, add &
in the font of current cmd will resolve this question.
1.2 run a powershell command
the advantage of powershell cmdlet then win cmd
especially the last one, it can make variables used in .
not just a sting which hard operation
sample of special characters of powershell
when they surrounded by single quotes(' '
), powershell accepts these characters as written, without the special meanning.