Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Multifunctional batch file help  (Read 3450 times)

0 Members and 1 Guest are viewing this topic.

Palwinder

  • Guest
Multifunctional batch file help
« on: November 11, 2004, 07:20:25 AM »
Hi Everyone :)

I am fairly new in batch file scripting. I have a problem that i have been working opn since last 5 days but I cannot figure how to do it.   ???

I want to create a bach file. Lets say it is named extra2.bat.

Then it should use replaceable parameters so that the user may choose what file extensions to display.

Allow any existing files to be copied to a new file that the user names.

Display the contents of the newly created file.

Provides a way for the user to change their mind and not to delete any files i.e. ask them for confirmation.


MalikTous

  • Guest
Re: Multifunctional batch file help
« Reply #1 on: November 12, 2004, 08:38:30 AM »
Use a set of batch files and a menu text. extra2.bat would simply be a command to start the thing off:

@echo off
cls
type menu2.txt


Menu2.txt would be a list of the available commands:

1) Copy file to new name, type 1 oldpath\oldname.ext newpath\newname.ext

2) Display file, type 2 path\name.ext

3) Confirm selection, type 3


Then you make up batch files 1.bat, 2.bat, and 3.bat.

1.bat is a sample:

@echo off
if exist %2 goto error
copy %1 %2
goto end
:error
echo Destination file already exists, choose another destination name. Press a key.
pause
:end
extra2


You'll figure out the other two...