tencent cloud

自动化助手

产品动态
产品简介
产品概述
产品优势
应用场景
访问管理
使用限制
购买指南
快速入门
操作指南
安装自动化助手客户端
免登录执行命令
批量执行命令
查看命令执行状态
故障处理
Windows实例问题诊断及处理
API 文档
History
Introduction
API Category
Making API Requests
Remote Command APIs
Scheduled Execution APIs
Managed Instance APIs
Scenario APIs
Statistics APIs
Data Types
Error Codes
常见问题
联系我们
词汇表
TAT 政策
TAT 隐私协议
TAT 数据处理和安全协议

ModifyCommand

PDF
聚焦模式
字号
最后更新时间: 2026-03-26 22:28:39

1. API Description

Domain name for API request: tat.intl.tencentcloudapi.com.

This API is used to modify a command.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyCommand.
Version Yes String Common Params. The value used for this API: 2020-10-28.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
CommandId Yes String

Command ID. call the DescribeCommands api to query command details.

.
CommandName No String

Command name. name only supports chinese, english, digits, underscore, separator "-", and decimal point. the maximum length cannot exceed 60 bytes.

.
Description No String

Command description. no more than 120 characters.

.
Content No String

The Base64-encoded command content, length cannot exceed 64KB.

.
CommandType No String

Command type. currently supports SHELL, POWERSHELL, BAT.

.
WorkingDirectory No String

Command execution path.

.
Timeout No Integer

Command timeout time.

value range: [1, 86400].

unit: seconds.

default value: 60.

when specifying the OutputCOSBucketUrl parameter, the timeout period includes the time taken to upload command output to COS.

.
DefaultParameters No String

The default value of custom parameters when the custom parameter feature is enabled. the field type is a json-encoded string, for example: {"varA": "222"}.
parameters must not be specified simultaneously for DefaultParameters and DefaultParameterConfs.
a comprehensive modification is applied, meaning all new default values must be provided when modifying.
this parameter can be modified only when EnableParameter of the command is true. obtain the EnableParameter settings of the command through the DescribeCommands (query command details) api.
the key is the custom parameter name, and the value is the default value of this parameter. both key and value are string-type.
there is an upper limit of 20 custom parameters.
custom parameter names must meet the following requirements: the upper limit of character quantity is 64, and the optional range is [a-zA-Z0-9-_].

.
DefaultParameterConfs.N No Array of DefaultParameterConf

Custom parameter array. if no parameter value is provided when invoking the command, the default value here will be used to replace it.
parameters do not support specifying both DefaultParameters and DefaultParameterConfs.
this parameter can be modified only when EnableParameter of the command is true. obtain the EnableParameter settings through the DescribeCommands (query command details) api.
up to 20 custom parameters are allowed.

.
Username No String

The username to run commands in a CVM or Lighthouse instance.
using minimum permission to execute commands is the best practice for permission management. we recommend running cloud assistant commands as a regular user identity.

.
OutputCOSBucketUrl No String

Specifies the cos bucket address for the uploaded log, which must start with https, such as https://BucketName-123454321.cos.ap-beijing.myqcloud.com.

.
OutputCOSKeyPrefix No String

Specify the directory for logs in the cos bucket. the directory naming has the following rules:

  1. use a combination of numbers, chinese and english, and visible characters, with a maximum length of 60.
  2. use / to split the path and quickly create subdirectories.
  3. consecutive / are not allowed; cannot start with /; cannot use .. as the folder name.
.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Modify Command

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyCommand
<Common request parameters>

{
    "CommandName": "second-command",
    "Description": "hello world!",
    "Content": "cHM=",
    "CommandType": "SHELL",
    "WorkingDirectory": "/root",
    "Timeout": 600,
    "CommandId": "cmd-63usjhmq"
}

Output Example

{
    "Response": {
        "RequestId": "9bea970a-0bab-495f-b0dd-de5eedfdf611"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.CommandContentInvalid Invalid command content.
InvalidParameterValue.CommandNameDuplicated Duplicate command name.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidCommandName Invalid command name.
InvalidParameterValue.InvalidOutputCOSBucketUrl Invalid OutputCOSBucketUrl.
InvalidParameterValue.InvalidOutputCOSKeyPrefix Invalid OutputCOSKeyPrefix.
InvalidParameterValue.InvalidWorkingDirectory Invalid command execution path.
InvalidParameterValue.ParameterInvalidJsonFormat The parameter is not a valid JSON string.
InvalidParameterValue.ParameterKeyContainsInvalidChar The parameter key contains invalid characters.
InvalidParameterValue.ParameterKeyDuplicated Duplicate parameter keys.
InvalidParameterValue.ParameterKeyLenExceeded The parameter key is too long.
InvalidParameterValue.ParameterNumberExceeded Too many parameters.
InvalidParameterValue.ParameterValueNotString The parameter value is not a string.
InvalidParameterValue.Range The parameter value is not in the valid range.
InvalidParameterValue.SupportParametersOnlyIfEnableParameter The custom parameter feature is not enabled.
InvalidParameterValue.TooLong Length limit exceeded.
ResourceNotFound.CommandNotFound The command does not exist.
ResourceNotFound.CosBucketNotFoundCode CosBucket does not exist.
UnauthorizedOperation.CamAuthFailed CAM authentication failed.
UnauthorizedOperation.InvalidToken Invalid token.
UnauthorizedOperation.MFAExpired The Multi-factor authentication (MFA) code expired.
UnauthorizedOperation.MFANotFound Multi-factor authentication (MFA) does not exist.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈