Windows Shell%ERRORLEVEL%变量是否有字符限制? [英] Does Windows shell %ERRORLEVEL% variable have a character limit?

查看:103
本文介绍了Windows Shell%ERRORLEVEL%变量是否有字符限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows Shell具有%ERRORLEVEL%变量,可用于查找已通过该Shell运行的进程的退出代码。因此,我可以在.bat文件中使用它来获取我从.bat文件中调用的外部脚本的退出代码。我想从我正在调用的进程中返回更丰富的错误信息(首先是堆栈跟踪)。我想从正在运行的Python脚本中返回它,可以使用Python的回溯模块来完成。我可以将其保存在%ERRORLEVEL%吗?有没有有关此变量的文档?

A Windows shell has an %ERRORLEVEL% variable that can be used to find the exit code of a process that has been run via the shell. I can therefore use this in a .bat file to obtain the exit code of an external script that I call from within the .bat file. I want to return richer error information from the process I'm calling (a stack trace in the first instance). I want to return this from a Python script that I'm running, which I can do using the Python 'traceback' module. Can I hold this in %ERRORLEVEL%? Is there any documentation for this variable?

推荐答案

%ERRORLEVEL%返回程序的退出代码,即它是一个整数值,没有字符限制。如用于DOS的Wiki文档中所述:

%ERRORLEVEL% returns the exit code of program i.e., it is a integer value and does not have a character limit. As mention in wiki document for DOS:


在DOS术语中, 错误级别 是由可执行程序或子例程返回的整数退出代码。 。错误级别通常在0到255之间。

In DOS terminology, an errorlevel is an integer exit code returned by an executable program or subroutine. Errorlevels typically range from 0 to 255.

同一文档的Windows部分说:


Windows使用32位无符号整数作为退出代码,尽管命令解释器将其视为带符号。

Windows uses 32-bit unsigned integers as exit codes, although the command interpreter treats them as signed.

这篇关于Windows Shell%ERRORLEVEL%变量是否有字符限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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