批处理字符串替换 [英] Batch string replace

查看:159
本文介绍了批处理字符串替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这样的变量

"Folder With Spaces/filename.ext"

当我通过PHP的system命令将其传递给程序时,参数之间用空格分隔

When I pass it to my program via PHP's system command, arguments are separated by spaces

system("batch.bat Folder With Spaces/filename.ext");

所以我有这样

system("batch.bat Folder_With_Spaces/filename.ext");

现在有一种方法可以将批处理程序中的_替换为了.

Is there a way now that it is back in the batch program to replace the _'s with 's

推荐答案

在您的批处理文件中尝试以下操作:

try this in your batch file:

set str=hello_world_try_this
set str=%str:_= %
echo.%str%

这篇关于批处理字符串替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆