Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 要重命名的Windows批处理<;int>_body.html到<;int>;。html_Batch File - Fatal编程技术网

Batch file 要重命名的Windows批处理<;int>_body.html到<;int>;。html

Batch file 要重命名的Windows批处理<;int>_body.html到<;int>;。html,batch-file,Batch File,似乎无法确定这一点。。。是否有编程/批处理方式将同一目录中的一组文件从1_body.html、2_body.html等重命名为1.html、2.html 我只是一个普通用户,所以我不会有权限做任何太花哨的事情:)。像往常一样,经过几个小时的挖掘,我在发布这篇文章后马上找到了答案 rename ?_body.html ?.html rename ??_body.html ??.html rename ???_body.html ???.html 处理好了 您也可以使用VBScript来完成。以下

似乎无法确定这一点。。。是否有编程/批处理方式将同一目录中的一组文件从1_body.html、2_body.html等重命名为1.html、2.html


我只是一个普通用户,所以我不会有权限做任何太花哨的事情:)。

像往常一样,经过几个小时的挖掘,我在发布这篇文章后马上找到了答案

rename ?_body.html ?.html
rename ??_body.html ??.html
rename ???_body.html ???.html

处理好了

您也可以使用VBScript来完成。以下是一个示例(基于):


将上述内容另存为要运行的目录中的something.vbs,然后双击以运行它。

若要格式化代码,请将其缩进四个空格,或者选择它并单击编辑器工具栏上的“代码”按钮(101010)。
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")  ''# Current directory
Set objFolder = objFSO.GetFolder(strFolder)
For Each strFiles In objFolder.Files
    If objFSO.GetExtensionName(strFiles) = "html" Then
        strComponents = Split(strFiles.Name, "_")
        strFiles.Name = strComponents(0) + ".html"
    End If
Next