Loading ...
Sorry, an error occurred while loading the content.

Renaming a folder

Expand Messages
  • Gary Kuznitz
    I would like to rename a folder. But first I want to make sure the folder name I am using does not exist. This is what I have: Set i=1 ... If exists
    Message 1 of 2 , Aug 12, 2012
    • 0 Attachment
      I would like to rename a folder. But first I want to make sure the folder name I am
      using does not exist. This is what I have:

      Set i=1
      :again
      If exists C:\WINDOWS\SoftwareDistribution.old_%i%
      set /A i+=1
      goto again
      Set x=i
      Set /A x+=1
      ren C:\WINDOWS\SoftwareDistribution SoftwareDistribution.old_%x%

      It isn't working. How can I fix it?

      Thanks,

      Gary
    • Glenn B. Lawler
      ... name ... Another approach would be to just rename the folder and check the ERRORLEVEL REN sets ERRORLEVEL to 1 if another file or folder exists with the
      Message 2 of 2 , Aug 12, 2012
      • 0 Attachment
        > I would like to rename a folder. But first I want to make sure the folder
        name
        > I am using does not exist. This is what I have:

        Another approach would be to just rename the folder and check the ERRORLEVEL

        REN sets ERRORLEVEL to 1 if another file or folder exists with the same
        name.

        Glenn Lawler
        www.incodesystems.com
      Your message has been successfully submitted and would be delivered to recipients shortly.