Linked Questions

Popular Questions

how to rename using variables batch

Asked by At

So I have this block of code in my batch file that works

set /p projectnumber= enter project number: 
set /p projectname= enter project name: 
ren "C:\projects\temp.dwg" "19-%projectnumber% - %projectname%.dwg

So i tried this and it works

set /p projectnumber= enter project number: 
set /p projectname= enter project name: 
set _dwg="C:\projects\temp.dwg"
ren %_dwg% "19-%projectnumber% - %projectname%.dwg" 

but what I would really like to have work is something like this

set /p projectnumber= enter project number: 
set /p projectname= enter project name: 
set _dwg="C:\projects\temp.dwg"
set _dwgrename="19-%projectnumber% - %projectname%.dwg"
ren %_dwg% %_dwgrename% 

but it doesn't seem to work this is the first real batch file that I have written so I'm not sure why the second code works and the third ones doesn't.

Related Questions