这用于通过替换删除字符串中的所有空格。 示例 @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 上一篇: 批处理字符串 下一篇: 批处理数组