Nothing displyed on the command prompt

October 30, 2011 at 23:50:12
Specs: Windows XP
Here is a simple batch program which copy one file(2nd argument) if 1st arg is provided as copy.
if no arguments are provided it should display ERROR on the command promt. But it is not performing any action if try to run the same programme.
@echo off
If %1 x==x GOTO ERROR
If not %1 == COPY DEL %2 GOTO END
copy %2 D:\*.* GOTO END

Please Tell me where m going wrong.
Thank You in advance

See More: Nothing displyed on the command prompt

Report •

October 31, 2011 at 03:39:44
You have no knowledge about batch scripting, your script is meaningless.

@echo off
if  /I "%1"=="copy" if exist %2 (copy %2 D:\ & goto :EOF)
echo. Missing or invalid parameters: %*

:EOF is the builtin exit point, you don't have to declare it. To know about a command type /? after its opcode, e.g. if /? and never code a command on the same row of its label. i.e.

echo. ERROR

Report •

October 31, 2011 at 04:11:27
Yes I have just started to learn batch scripting, and for the same I m using one PDF that .From that PDF only m doing the batch programmes. If you could tell which book should i refer for the same I will be thankfull.

Report •

October 31, 2011 at 04:19:05
I don't know sprcific books, but googling on the net looking for NT batch (DOS is died today) you can find a lot of tutorials.

Report •

Related Solutions

October 31, 2011 at 06:26:35
Ok thank You. I will refer another PDF then.

Report •

Ask Question