@ECHO OFF setlocal REM Clear Screen of information cls REM Prompt for Filename :FileName REM If fileName is blank go to Error prompt. SET fileName= SET /P Filename=Please enter your filename: IF "%fileName%"=="" (goto FileNameError) else (goto confirm) REM Confirm file Renaming :confirm REM SET FileName= SET /P FileName=Would you like to rename the file to Post-%FileName%.asc? (y or press n): IF /i "%Filename%"=="y" (goto renamePost.asc) else IF "%FileName%"=="n" (goto success) REM Rename File :renamePOST.asc rename c:\post.asc Post-%filename%.asc echo ..file renamed to Post-%FileName%.asc copy c:\Post-%FileName%.asc to c:\TM463 echo ...File copied to c:\TM463 directory REM Filename is Blank Error MEssage :FileNameError ECHO You did not enter a filename. SET FileNameRetry= SET /P FileNameRetry=Retry? (y, then enter or press enter to exit): IF /i "%FileNameRetry%"=="y" (goto Filename) else (go to success) :success echo SUCCESS!! The file has been rename to Post-%filename%.asc echo SUCCESS!! The file has been copied to c:\TM463 :end
From novice to tech pro — start learning today.