windows命令行基本用法:

本文介绍了一系列常用的文件管理和操作命令,包括目录的创建、切换、删除等,并解释了如何使用这些命令进行高效的文件管理工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

转载于:https://www.cnblogs.com/AbsolutelyPerfect/p/7821231.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值