|
Answer» I've been at this for the last 3 hours and I finally got my replaceable parameter command to work. The problem I am having is using it in a batch program. I have a menu program that when you hit the specific menu number the batch program that was created would kick in. Now if I run batch program on its own it worksk, The problem is how do I get the replaceable parameter batch program I created to run. when I hit the menu option it automatically runs it with errors. I guess what I'm asking how can I get the batch program to issue the command and ask the user for the parameter 1 and parameter 2
When I run the program I get the following error message: The SYSTEM cannot FIND the path specified
here is my menu program batch file:
echo REM Author Nick echo off f: cd \menuprogram CLS echo. REM Display Menu echo. echo ********************************************** echo *** Nick's UTILITY Menu *** echo ********************************************** echo. echo 1. Create a subdirectory named d:\computerrx echo 2. Make inventory fiiles echo 3. Copy Files echo 4. Copy any file from any directory to d:\computerrx\backup echo. echo. echo off pause
Here is the batch file I am having trouble with, this refers to menu option 4,
file name is 4.bat
echo off REM Author Nick echo off REM batch program that will ALLOW user to copy any file located in any directory REM to any drive, any directory, and name any name echo. echo. f: cd menu program pause copy f:%1 f:\%2 echo. echo. rem loop back to menu cd menuprogram menu.bat
Any help would be so appreciated. I am so new to MS DOS / Command line programing so any advice or guidence I would be so greatful.Please use Bulletin Board CODE tags around your CODE to distinguish code from general comments. It really helps a lot. http://en.wikipedia.org/wiki/BBCode
You are not showing us the entire code from the menu batch file so I have no idea how you are executing the 4.bat file from the Menu batch file.
If you are using Menu.bat to execute 4.bat it doesn't make any sense to then execute menu.bat from 4.bat
You need to show us all the code from each batch file.Hello Squashman, the menu.bat is the entire batch file for the menu program.
at the end of the 4.bat program i want the batch program to loop back to the menu that is why have it there.
I would like the user to hit option 4 on the menu and be given the replaceable parameter command along with request to enter the parameters. What version of Windows will you be running this batch file on?
Code: [Select]echo off REM Author Nick
pushd F:\menuprogram
REM Display Menu :menu cls echo. echo ********************************************** echo *** Nick's Utility Menu *** echo ********************************************** echo. echo 1. Create a subdirectory named d:\computerrx echo 2. Make inventory fiiles echo 3. Copy Files echo 4. Copy any file from any directory to d:\computerrx\backup echo 5. exit echo. set /p ans=Please select an option: IF "%ans%"=="5" exit /b IF "%ans%"=="4" goto copyfile goto menu
:copyfile REM Function that will allow user to copy any file located in any directory REM to any drive, any directory, and name any name :source set /p source=Please type source path and file name: IF NOT EXIST "F:\%source%" echo Source file does not exist &goto source set /p dest=Please type destination path and file name: copy "F:\%source%" "F:\%dest%" goto Menu
|