Rename parent folder by child bat file [SOLVED]

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
w64bit
Posts: 1
Joined: 21 Aug 2021 06:53

Rename parent folder by child bat file [SOLVED]

#1 Post by w64bit » 21 Aug 2021 06:57

FOLDER1
|___ REN.bat

It is possible to rename FOLDER1 by running REN.bat?
If yes, what is the command?
Thank you
Last edited by w64bit on 21 Aug 2021 10:13, edited 1 time in total.

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

Re: Rename parent folder by child bat file

#2 Post by aGerman » 21 Aug 2021 07:33

First of all: NEVER name a batch file the same as a command!
As to your question: You'll get an access violation as long as the working directory is the folder to be renamed.

Code: Select all

@echo off &setlocal
pushd "c:\"
ren "%~dp0\." "FOLDER1"
popd
echo done
pause
Steffen

Post Reply