Batch-script-remove-all-spaces
提供:Dev Guides
バッチスクリプト-すべてのスペースを削除
これは、置換によって文字列内のすべてのスペースを削除するために使用されます。
例
@echo off
set str = This string has a lot of spaces
echo %str%
set str=%str:=%
echo %str%
上記のプログラムについて注意すべき重要なことは、文字列からすべてのスペースを削除するために:=演算子が使用されることです。
出力
上記のコマンドは、次の出力を生成します。
This string has a lot of spaces
Thisstringhasalotofspaces