惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - 星小梦

Linux系统调整java程序启动用户,导出xlsx时抛出Permission denied异常问题。 vue2的devtools开发工具卡死现象的解决方法 echarts图表在浏览器上打印出现裁剪的问题 apache echarts数据点重影或 Cannot read properties of undefined (reading 'type')错误问题 yarn install出现error Error: certificate has expired异常 git多代码仓库合并的方式 docker容器oshi如何获取宿主机的运行状态信息? su命令引起的nohup进程以root身份启动导致的问题 docker-compose启动服务,影响其他服务的原因 xxl-job provider netty_http server caught exception flutter升级导致的旧项目的运行环境问题排查记录 vue3插件库以及对JSX的支持。 JSX、TSX扩展语法学习材料 commitlint Lint 提交消息格式控制 Chromium历史版本下载方式 Window10 关闭Edge浏览器的多选项卡通过Alt+Tab组合键切换的方式 Postgres16数据库集成外部库dblink和postgres_fdw扩展的方式 java 泛型类型如何保留类型的信息的方式 Postgres16 常见问题 docker镜像安装字体支持,解决jdk服务验证码生成找不到字体问题
window和Linux命令行执行多条命令的方法
星小梦 · 2025-07-18 · via 博客园 - 星小梦

顺序执行

  • PowerShell / Bash: cmd1; cmd2
  • CMD: cmd1 & cmd2

条件执行

  • 成功才执行: cmd1 && cmd2
  • 失败才执行: cmd1 || cmd2

获取退出码 / 状态

  • PowerShell: $LASTEXITCODE(int)、$?(bool)
  • CMD: %ERRORLEVEL%
  • Bash: $?

常见退出码

  • 0:成功
  • 1:通用错误
  • 2:参数错误
  • 126:无执行权
  • 127:命令未找到
  • 128+N:信号 N 导致

实例

rem 退出码为1
ls
echo %ERRORLEVEL%


rem 退出码为0
netstat -tnop
echo %ERRORLEVEL%

复制请注明出处,在世界中挣扎的灰太狼

posted @ 2025-07-18 15:21  星小梦  阅读(59)  评论(0)    收藏  举报

公告