Jump to content

dos "for command" in a batch file


Recommended Posts

Guest NewsBot
Posted

>>> not sure if I submitted to the correct forum <<<  ?

in a specific directory "C:UsersEPI-QCDesktopDailyQC©STSNRT_QC" There are many files with this format

example:

SWB12-1852P1-028-Client_EOL_Report.sts

all the char between the "-" are variable values, all other char are fixed values

I want to rename all the files to the following format

example:

028-SWB12-1852P1-Client_EOL_Report.sts

I created the following script but something is wrong with it

for /F "tokens=1-4 delims=-" %%G in (' dir /C:UsersEPI-QCDesktopDailyQC©STSNRT_QC .sts') do rename "%%G^&%%H^&%%I^&%%J" "%%I^&%%G^&%%H^&%%J"

I think that maybe I specified an illegal delimiter "-" (?)

maybe my syntax for dir is incorrect (?)

something else (?)

 

Please can you help me 

 

Thank you

Ron1Cebu

 

 

 

View the thread

  • Replies 0
  • Created
  • Last Reply

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...