Batch-script-right-string

提供:Dev Guides
移動先:案内検索

バッチスクリプト-右の文字列

これは、文字列の末尾から文字を抽出するために使用されます。

@echo off
set str = This message needs changed.
echo %str%

set str = %str:~-8%
echo %str%

上記のプログラムについて注意すべき重要なことは、文字列の右側が〜-「抽出する文字数」演算子を使用して抽出されることです。

出力

上記のコマンドは、次の出力を生成します。

This message needs changed.
changed.