change a file's name inside a directory problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
rasil
Posts: 23
Joined: 23 Apr 2020 13:05

change a file's name inside a directory problem

#1 Post by rasil » 04 Mar 2021 15:00

hi,

I want to change this file called databaseTMP.scu to database.scu but for some reason this isn't working it just says The syntax of the command is incorrect. this is what I've tried

Code: Select all

ren "C:\Users\Public\Documents\databaseTMP.scu" "C:\Users\Public\Documents\database.scu"
Rasil

aGerman
Expert
Posts: 4098
Joined: 22 Jan 2010 18:01
Location: Germany

Re: change a file's name inside a directory problem

#2 Post by aGerman » 04 Mar 2021 15:18

The second parameter must not contain the path. Only the new file name.

Steffen

ShadowThief
Expert
Posts: 1015
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: change a file's name inside a directory problem

#3 Post by ShadowThief » 04 Mar 2021 15:21

The REN cannot have a drive or path in the destination. cd to C:\Users\Public\Documents and then just ren databaseTMP.scu database.scu instead.

Squashman
Expert
Posts: 4268
Joined: 23 Dec 2011 13:59

Re: change a file's name inside a directory problem

#4 Post by Squashman » 04 Mar 2021 17:15

Some great information in the help file.

Code: Select all

H:\>rename /?
Renames a file or files.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

Post Reply