substring using bat命令

use*_*550 7 substring batch-file

我的bat文件中有以下内容.说

set path = c:\ temp\test

所以基本上我想要一个输出,它会给我结果为c:\ temp \

我没有在bat命令中找到任何等效索引.

谢谢.

Joa*_*ous 5

背景:

>set fullname=c:\mypath\oldfile
>set changedname=%fullname:oldfile=newfile%
>echo %changedname%
c:\mypath\newfile
Run Code Online (Sandbox Code Playgroud)

适用于问题:

> set fullname=c:\mypath\oldfile
> set pathonly=%fullname:oldfile=%
> echo %pathonly%
c:\mypath\
Run Code Online (Sandbox Code Playgroud)