windows命令行基本用法:
pwd print working directory
hostname my computer's network name
mkdir make directory
cd change directory
ls list directory
rmdir remove directory
pushd push directory
popd pop directory
cp copy a file or directory
robocopy robust copy
mv move a file or directory
more page through a file
type print the whole file
forfiles run a command on lots of files
dir -r find files
select-string find things inside files
help read a manual page
helpctr find what man page is appropriate
echo print some arguments
set export/set a new environment variable
exit exit the shell
runas DANGER! become super user root DANGER!
________________________________________________________
The pushd command takes your current directory and "pushes" it into a list for later, then it changes to another directory. It's like saying, "Save where I am, then go here."
The popd command takes the last directory you pushed and "pops" it off, taking you back there. Finally, on Unix pushd, if you run it by itself with no arguments, it will switch between your current directory and the last one you pushed. It's an easy way to switch between two directories. This does not work in PowerShell.
You already know this, but remember that mkdir -p (on Linux/macOS) will make an entire path even if all the directories don't exist. That's what I did very first for this exercise.
Remember that Windows will make a full path and does not need the -p.
_________________________________________________________
make a new empty file:
on windows:touch or New-item(亲试有效)
————————————————————————————————
• Use the cp -r command to copy more directories with files in them
• Notice how sometimes I put a / (slash) at the end of a directory? That makes sure the file is really a directory, so if the directory doesn't exist I'll get an error.
_____________________________________________________________
mv:Moving files or, rather, renaming them. It's easy: give the old name and the new name.
PS C:\Users\b2utyyomi\temp\stuff\lala> mv k.txt ..
PS C:\Users\b2utyyomi\temp\stuff\lala> ls
PS C:\Users\b2utyyomi\temp\stuff\lala> pushd ..
PS C:\Users\b2utyyomi\temp\stuff> ls
目录: C:\Users\b2utyyomi\temp\stuff
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2017/11/12 13:00 lala
d----- 2017/11/12 12:48 something
------ 2017/11/12 12:46 0 a.txt
-a---- 2017/11/12 12:46 0 b.txt
-a---- 2017/11/12 12:58 7 k.txt
PS C:\Users\b2utyyomi\temp\stuff> popd
PS C:\Users\b2utyyomi\temp\stuff\lala> mv ../k.txt .
PS C:\Users\b2utyyomi\temp\stuff\lala> ls
目录: C:\Users\b2utyyomi\temp\stuff\lala
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2017/11/12 12:58 7 k.txt
__________________________________________________
more:
This is one way to look at the contents of a file. It's useful because if the file has many lines, it will "page" so that only one screenful at a time is visible. In the Do More section you'll play with this some more.
————————————————————————————————————————paste from Learn Python 3 the hard way