Batch file to rename a folder and prompt the user

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kumar_thabe
Posts: 1
Joined: 10 Nov 2008 06:54

Batch file to rename a folder and prompt the user

#1 Post by kumar_thabe » 10 Nov 2008 07:09

Hi, I am trying to create a batch file to do the followings tasks.

Iv'e got a project folder and that has all the settings. When I create a new project folder then I copy the folder "New Projects" and rename it. But that has to be done by script or the batch file. And the issue is, the batch file or the script file should prompt the user to enter the new folder name. The old folder name is always same, But the new folder name is always different.

I am trying to create a batch file but it's failled. Enyone can help me?

Thanks a lot!

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 22 Nov 2008 23:59

kumar_thabe,

How about this:

Code: Select all

@echo off
set "prjFolder=c:\YourProjectFolder\"
set "srcFolder=New Projects"
set /p "trgfolder=Enter Name for Target Folder: "
xcopy /discy "%prjFolder%%srcFolder%" "%prjFolder%\%trgfolder%"
pause

DosItHelp? :wink:

Post Reply