JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
882 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am creating a Batch script for following tasks:
Task 1: Find a specific name (.txt.) and replace with specific name(.txt_) in all the file name in a folder.
Task 2: Append a symbol(_) before last 6 digit of a file name in batch script.
As Is: Test.txt.20210808654321
To be: Test.txt_20210808_654321
I have created a script for Task 1 and it is working.
Script:
@echo off
setlocal enabledelayedexpansion
set "replace=.txt_"
set "find=.txt."
for %%i in ("C:\Script test\*.*") do (
set name=%%~ni
set ext=%%~xi
ren "%%i" "!name:%find%=%replace%!!ext!"
)
pause
I am struck in Task 2 (= Append a symbol(_) before last 6 digit of a file name).
Please help