Page 1 of 1

Rename parent folder by child bat file [SOLVED]

Posted: 21 Aug 2021 06:57
by w64bit
FOLDER1
|___ REN.bat

It is possible to rename FOLDER1 by running REN.bat?
If yes, what is the command?
Thank you

Re: Rename parent folder by child bat file

Posted: 21 Aug 2021 07:33
by aGerman
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