1.

Solve : suppress an error message..???

Answer»

if there is no disk in dir a:\ and i do "start a:" in cmd-batch, is there anyway to suppress the "Windows - No Disk" Error message that pops up..??Code: [Select]if exist a:\ start a:didn't WORK...
the "Windows - No Disk" Error message still pops up..??
Try this

Code: [Select]dir a: 2>nulwhat if i want to use this code
TYPE "C:\1.TXT" > "A:\1.TXT"
but there is no disk in drive A:\
And the "Windows - No Disk" Error message still pops up..
Is there anyway to suppress it now..??did you manage to hide the message with

dir a: 2>nul ?

if the ANSWER is yes, try this


dir a:>nul 2>nul && TYPE "C:\1.TXT" > "A:\1.TXT"

Why are you using type instead of copy?


yes the message did not show with dir a: 2>nul
but i dont want to use the DIR command BECUASE if no files exist in A:\ then your code
dir a:>nul 2>nul && TYPE "C:\1.TXT" > "A:\1.TXT"
will not work propperly...!!!

is there anyway to suppress the error message using this "If Exist A:\ TYPE "C:\1.TXT" > "A:\1.TXT"Quote from: gumbaz on October 13, 2008, 12:15:18 PM

yes the message did not show with dir a: 2>nul
but i dont want to use the DIR command becuase if no files exist in A:\ then your code
dir a:>nul 2>nul && TYPE "C:\1.TXT" > "A:\1.TXT"
will not work propperly...!!!

Have you tried it?

if a formatted floppy is in the drive then a: exists then dir a: will work the output goes to nul so you don't see it and the && test is passed and the type "C:\1.txt" will happen. (unless the floppy has the write protect switch in the protect position)

if a: does not exist then dir a: will not work and the && test is failed and the type C:\1.txt will not happen

Maybe you don't know what && means?

And why don't you answer about why you are using TYPE instead of COPY?
yes i tried it..
like i said though if there are no files or folders in A:\ Dir A: will fail
i tried on my usb drive E: your code dir E:>nul 2>nul && TYPE "C:\1.TXT" > "E:\1.TXT"
there were no files or folders on the drive so Dir E: failed and so did the rest of the code..

i use TYPE instead of COPY becuz i don't want to use any external copy.exe

like i say earlier...
is there anyway to use this >nul FEATURE in this code
"If Exist A:\ TYPE "C:\1.TXT" > "A:\1.TXT"Quote from: gumbaz on October 13, 2008, 01:17:58 PM
i use TYPE instead of COPY becuz i don't want to use any external copy.exe

There is no copy.exe in Windows. Where did you get that idea? Copy is an internal command just as type is.

Quote
like i say earlier...
is there anyway to use this >nul feature in this code
"If Exist A:\ TYPE "C:\1.TXT" > "A:\1.TXT"

Try this

XCOPY A:\Is_Ready.Test > NUL
IF NOT ERRORLEVEL 4 ECHO Drive is ready.


Discussion

No Comment Found