cmd

버전 1.0.0.0 (2.49 KB) 작성자: Jonathan Suever
Execute a command on the host operating system with a specified timeout
다운로드 수: 257
업데이트 날짜: 2015/8/17

cmd - Execute a command on the host operating system

This function is very similar to Matlab's builtin SYSTEM function
with the exception that it provides a way for the user to specify a
timeout time (in seconds) after which the function will error out.

For example, the following ping to an unavailable IP address could
take several minutes to complete but we can cause it to timeout if
there is no response within 5 seconds

status = cmd('ping -n 1 255.0.0.0', 5);

Obviously, many OS commands (such as ping) have a timeout parameter
but this function allows the user to not worry about these
command-specific parameters and have a consistent way of specifying
a timeout value for external commands.

USAGE:
[status, stdout, stderr] = cmd(command, *timeout)

INPUTS:
command: String, Command to be evaluated by the host OS

timeout: Integer, (Optional) Number of seconds to wait for the
process to complete. A value of either 0 or Inf
indicates that there is no timeout (Default = 0)

OUTPUTS;
status: Integer, Exit code returned by the process. Typically a
value of 0 indicates that the process completed without
error while a non-zero value indicates some sort of
error.

stdout: String, Output from the process that was printed to
standard output.

stderr: String, Output from the process that was printed to
standard error buffer. Can be used in case of a
non-zero return code to determine what type of error
occurred.

See also SYSTEM, UNIX, DOS

인용 양식

Jonathan Suever (2024). cmd (https://github.com/suever/cmd), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Programming에 대해 자세히 알아보기
태그 태그 추가

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.0.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.