cmd学习笔记

  • for %var in (set) do commond
for %one in (1,2,3,4,5) do echo
-->1
-->2
-->3
-->4
-->5
for /r . %i in (.) do @echo %i >> t.txt && t.txt
##这一步生成目录文件名到文件t.txt
for /f "skip=1 delims=." %i in (t.txt) do @echo "%i" >> tar.txt
##处理上一步生成的t.txt,从中读取内容并略去第一行,将每一行加上""后输出至tar.txt。加引号处理是因为7z命令行的要求
del t.txt
for /f "delims=" %i in (tar.txt) do 7z a %i %i
##利用处理后生产的tar.txt,再利用7z命令,将文件压缩。生成的是.7z,放在了各个文件夹中
  • ren/rename TargetFileName Newname

  • 7z e .\ -o.\ -pXXXXX -ssp

​ 直接解压压缩文件中的目录,不考虑其中的组织结构而直接使其平铺解压 注意:不带-符号的需要空一格后输入参数;带-负号的不用加空格,直接写出参数

​ 解压并保持源文件中的目录结构

​ 设定解压后文件的存放地址为当前目录

​ 设置解压密码为XXXXX,-p后不用带空格

​ 使解压后的文件不带空文件夹

​ 将当前目录下的文件设置为一个7z压缩文件

​ 压缩完毕后删除文件

del *.txt表示删除后缀为 .txt的目录下文件

X:\Microsoft VS Code\bin添加到系统变量 path

在cmd中输入 code [fileName]

cd.>fileName.fileType
echo hi there > a.txt

上面的命令总共完成了两步操作

1. 在命令行显示hi there
1. 将命令行输出的内容改变输出地点,改至./a.txt中。既先创建./a.txt,再将命令行输出放入其中。

如果只是想将内容添加至文件,可以使用下列命令

echo hi there again! >> a.txt

>>会将输出方法改变为追加,而 >则为覆盖。

||前后都是命令,

  • ||前的命令出错后才会执行 ||后的命令
  • ||前的命令正确执行则不会执行 ||后的命令
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="cmd here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Windows\\System32\\cmd.exe s k pushd %V"

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\ShellNew

@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS

REM --
REM -- Copyright note
REM -- This script is provided as is.  No waranty is made, whatso ever.

REM -- You may use and modify the script as you like, but keep the version history with
REM -- recognition to http://www.dostips.com in it.

REM --

REM Version History:
REM         XX.XXX      YYYYMMDD Author Description
SET "version=01.000"  &:20051201 p.h.   initial version, origin http://www.dostips.com
SET "version=01.001"  &:20060122 p.h.   Fix missing exclamation marks in documentation (http://www.dostips.com)
SET "version=01.002"  &:20060218 p.h.   replaced TEXTAREA with PRE XMP (http://www.dostips.com)
SET "version=01.003"  &:20060218 p.h.   php embedding (http://www.dostips.com)
SET "version=01.004"  &:20060723 p.h.   fix page links for FireFox (http://www.dostips.com)
SET "version=01.005"  &:20061015 p.h.   invoke HELP via '"call" help', allows overriding help command with a help.bat file (http://www.dostips.com)
SET "version=01.006"  &:20061015 p.h.   cleanup progress indicator (http://www.dostips.com)
SET "version=01.007"  &:20080316 p.h.   use codepage 1252 to support european users (http://www.dostips.com)
SET "version=02.000"  &:20080316 p.h.   use FOR command to generate HTML, avoids most escape characters (http://www.dostips.com)
SET "version=02.000"  &:20100201 p.h.   now using css and xhtml
REM !! For a new version entry, copy the last entry down and modify Date, Author and Description
SET "version=%version: =%"

for /f "delims=: tokens=2" %%a in ('chcp') do set "restore_codepage=%%a"
chcp 1252>NUL

set "z=%~dpn0.htm"

rem echo.^> >"%z%"
echo.^> >"%z%"

set "title=DOS Command Index"
for /f "tokens=*" %%a in ('ver') do set "winver=%%a"

echo.Creating the header ...

for %%A in (
            ""
            ""
            ""
            "%title%"
            ""
            ""
            ""
            ""
            "

%title%

" "
" "" " " " " " " "
Windows Version:%winver%
Document Source:" " http://www.dostips.com
" " http://www.dostips.com/%~nx0.php" "
Created by:" " %~nx0
Source Code below
" "
" "

" "" ) do echo.%%~A>>"%z%" echo.Creating the index ... set /a cnt=0 for /f "tokens=1,*" %%a in ('"help|findstr /v /b /c:" " /c:"For more""') do ( for %%A in ( " " ) do echo.%%~A>>"%z%" set /a cnt+=1 ) for %%A in ( "
%%a%%b
" "

" ) do echo.%%~A>>"%z%" echo.Extracting HELP text ... call:initProgress cnt for /f %%a in ('"help|findstr /v /b /c:" " /c:"For more""') do ( echo.Processing %%a for %%A in ( "
TOP
" "

%%a

" "
"
            ) do echo.%%~A>>"%z%"
    call help %%a >>"%z%" 2>&1
    echo  ( >>"%z%"
    for %%A in (
            "

"
) do echo.%%~A>>"%z%"
call:tickProgress
)

echo.Injecting source script ...

for %%A in (
""
"

"
"

"
"
TOP

"
"

DOS Batch Script Source that created this Document

"
"This %title% has been created automatically by the following DOS batch script:"
"

"
"

"
"

"
            ) do echo.%%~A>>"%z%"
type "%~f0" >>"%z%"

echo.Creating the footer ...

echo  ( >>"%z%"
for %%A in (
            "

"
""
"

"
""
""
) do echo.%%~A>>"%z%"

chcp %restore_codepage%>NUL
explorer "%z%"

:SKIP
REM.-- End of application
FOR /l %%a in (5,-1,1) do (TITLE %title% -- closing in %%as&ping -n 2 -w 1 127.0.0.1>NUL)
TITLE Press any key to close the application&ECHO.&GOTO:EOF

::-----------------------------------------------------------
::helper functions follow below here
::-----------------------------------------------------------

:initProgress -- initialize an internal progress counter and display the progress in percent
:: -- %~1: in - progress counter maximum, equal to 100 percent
:: -- %~2: in - title string formatter, default is '[P] completed.'
set /a "ProgressCnt=-1"
set /a "ProgressMax=%~1"

set "ProgressFormat=%~2"
if "%ProgressFormat%"=="" set "ProgressFormat=[PPPP]"
set "ProgressFormat=%ProgressFormat:[PPPP]=[P] completed.%"
call :tickProgress
GOTO:EOF

:tickProgress -- display the next progress tick
set /a "ProgressCnt+=1"
SETLOCAL
set /a "per=100*ProgressCnt/ProgressMax"
set "per=%per%%%"
call title %%ProgressFormat:[P]=%per%%%
GOTO:EOF

Original: https://www.cnblogs.com/dysonxxxxx/p/16582115.html
Author: dysonkkk
Title: cmd学习笔记

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/578830/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • Docker容器搭建android编译环境

    Docker容器搭建android编译环境 .版本:v0.4作者:河东西望日期:2022-7-12. 1.1 手动部署 安装&#…

    Linux 2023年6月7日
    0100
  • Linux下PAM模块学习总结

    Linux下PAM模块学习总结 转载自 https://www.cnblogs.com/kevingrace/p/8671964.html Original: https://ww…

    Linux 2023年6月7日
    0104
  • 版本控制gitlab

    版本控制gitlab 版本控制gitlab 版本控制介绍 常用的版本控制工具: gitlab部署 gitlab网页界面的基本使用 使用命令行的方式进行上传文件 版本控制介绍 版本控…

    Linux 2023年6月6日
    0128
  • 国产化之Arm64 CPU+银河麒麟系统安装.NetCore

    背景 某个项目需要实现基础软件全部国产化,其中操作系统指定银河麒麟,银河麒麟就是一个Linux发行版,数据库使用达梦V8,这个数据库很多概念和Oracle相似,CPU平台的范围:龙…

    Linux 2023年5月27日
    087
  • 解决nginx反向代理Mixed Content和Blockable问题

    bash;gutter:false; nginx配置https反向代理,按F12发现js等文件出现Mixed Content,Optionally-blockable 和 Bloc…

    Linux 2023年6月7日
    0144
  • Linux基础03

    一些常见目录 usr目录 /usr/local/ # ⽤于保存⽤户安装软件程序信息 相当于windos中D:\Program Files (x86) linux系统安装软件的四种方…

    Linux 2023年6月7日
    097
  • 微信聊天内容可以被监听吗

    上班摸鱼与网络安全 成为了锅叔在博客园阅读数最高的一篇文章,足可见同学们上班摸鱼的热情,同时也反映了大家对网络安全的担忧…… 对于其中的一个存疑问题,&#8…

    Linux 2023年6月13日
    0101
  • 一文搞懂 Redis 架构演化之路

    作者:ryetan,腾讯 CSIG 后台开发工程师 现如今 Redis 变得越来越流行,几乎在很多项目中都要被用到,不知道你在使用 Redis 时,有没有思考过,Redis 到底是…

    Linux 2023年5月28日
    0107
  • Redisson实现分布式锁源码解读

    文章目录 一、分布式锁的概念 和 使用场景 二、将redis官网对于分布式锁(红锁)的定义和Redisson实现做概括性总结 三、基于Redisson的分布式实现方案 四、加锁过程…

    Linux 2023年5月28日
    089
  • WEB自动化-07-Cypress Test Runner

    7 Test Runner 7.1 概述 Test Runner是Cypress非常重要一个组件,其主要作用为运行测试、更改配置、将运行的测试结果写入控制台等等。 打开Cypres…

    Linux 2023年6月7日
    0101
  • 什么是草台班子?

    有个朋友最近想跳槽,他对管理的兴趣不大,而且认为自己的性格也不适合做管理,更想成为技术专家。基于这些考虑,他希望能进入知名大厂,如果面试不顺利,去小而美公司也行。他的面试经验不多,…

    Linux 2023年6月6日
    0114
  • Linus:“我删除了Linux,因为它就是个垃圾”

    1月 25日, Linus Torvalds 在 Linux 的 GitHub 仓库中提交了一个恶作剧 README页面,其备注名为《delete linux because it…

    Linux 2023年6月13日
    0107
  • kafka 在 zookeeper 中保存的数据内容

    转载请注明出处: 服务器上下载 kafka : wget https://archive.apache.org/dist/kafka/2.4.0/kafka_2.12-3.2.0….

    Linux 2023年6月14日
    0106
  • jmeter&WebSocket直播间性能测试

    http://t.csdn.cn/GfXzJ 1.Jmeter本身是支持HTTP方法,要测试WebSocket的接口,首先要安装插件。 安装插件的方法:1)首先下载插件管理器① 访…

    Linux 2023年6月8日
    0101
  • stat命令的实现

    任务详情 学习使用stat(1),并用C语言实现 提交学习stat(1)的截图 man -k ,grep -r的使用 伪代码 产品代码 mystate.c,提交码云链接 测试代码,…

    Linux 2023年5月27日
    0100
  • 从零开始构建Linux

    目的:深入了解以Linux内核为基础的系统是如何组成,运行,以构建一个最基础的,纯净的系统。 LFS构建步骤宿主机准备– linux操作系统安装– 使用独立…

    Linux 2023年6月7日
    0100
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球