在Windows OS中以cmd打印退出代码 [英] print exit code in cmd in windows os

查看:112
本文介绍了在Windows OS中以cmd打印退出代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows操作系统中以cmd打印退出代码....一些命令返回退出代码...此代码存储的位置...我想打印此退出代码并将其分配给变量

print exit code in cmd in windows os ....some command return exit code ...where this code store...and i want to print this exit code and assign it to variable

推荐答案

您可以使用%ERRORLEVEL%环境变量,它将保存最后返回的代码。您可以根据需要将其回显或将其分配给变量。

You can use %ERRORLEVEL% environment variable, it will hold the last code that was returned. You can echo it or assign it to a variable, depending on your needs.

这篇关于在Windows OS中以cmd打印退出代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆