博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Windows PowerShell Exit Codes
阅读量:7086 次
发布时间:2019-06-28

本文共 825 字,大约阅读时间需要 2 分钟。

Windows PowerShell Exit Codes

 

PSMDTAG:FAQ: How can my script control the PowerShell exit code?

Answers:

  1. A normal termination will set the exitcode to 0
  2. An uncaught THROW will set the exitcode to 1
  3. The EXIT statement will stop the process and set the exitcode to whatever is specified.

 

c:\>powershell -noprofile -command "Write-output Test"

Test
c:\>echo %errorlevel%
0
c:\>powershell -noprofile -command "Write-output Test; throw 'ERROR'"
Test
ERROR
At line:1 char:25
+ Write-output Test; throw  <<<< 'ERROR'
c:\>echo %errorlevel%
1
c:\>powershell -noprofile -command "Write-output Test; exit 31492"
Test
c:\>echo %errorlevel%
31492

 

Jeffrey Snover [MSFT]

Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:    
Visit the Windows PowerShell ScriptCenter at

转载于:https://www.cnblogs.com/hualiu0/p/5105281.html

你可能感兴趣的文章
windows下整合nginx与php
查看>>
让消费者觉得占了便宜
查看>>
改变ListView快速滑块的图像
查看>>
MySQL主主复制,出错
查看>>
caffe中数据库的设计
查看>>
网络爬虫更新策略和分布式抓取系统机构
查看>>
clang记录
查看>>
java在线预览txt、word、ppt、execel,pdf代码
查看>>
Javascript极速快感
查看>>
合作共赢位来_张亚超
查看>>
Graphics Animation
查看>>
Glow Label
查看>>
FullScreenAnimations
查看>>
iOS8企业项目实战---windows系统下安装虚拟机-mac系统
查看>>
编译ko文件
查看>>
hbase中安装和删除observer协处理器
查看>>
开源 免费 java CMS - FreeCMS2.0 会员密码设置
查看>>
MongoDB入门
查看>>
CTS测试流程及注意事项
查看>>
java枚举类型
查看>>