使用BAT命令串 [英] substring using bat command

查看:150
本文介绍了使用BAT命令串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的bat文件以后的事。说

I have the following thing in my bat file. say

设置path = C:\\ TEMP \\测试

set path=c:\temp\test

所以基本上我想有一个输出,这将使我结果为C:\\ TEMP \\

so basically i want to have an output which would give me the result as c:\temp\

我没有找到蝙蝠命令任何的indexOf等价的。

i didnt find any indexof equivalent in bat command.

感谢。

推荐答案

背景:

>set fullname=c:\mypath\oldfile
>set changedname=%fullname:oldfile=newfile%
>echo %changedname%
c:\mypath\newfile

适用于问题:

> set fullname=c:\mypath\oldfile
> set pathonly=%fullname:oldfile=%
> echo %pathonly%
c:\mypath\

这篇关于使用BAT命令串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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