1.

Solve : batch file using %1\Nul?

Answer»

::)

I am CREATING this batch file:

When you key in SWAP2 dirname filename1 filename2, the file
names will be reversed in a specific directory.
The batch file will CHANGE to the specified directory
prior to performing the “swap.”

would this be correct format command?

cls
dir A:\ /a:-d /o:nr /b
pause

One of the items you wish to test for is the existence of a directory.
(Hint: Remember %1\Nul.) If you key in a subdirectory name where
a file name is expected, the batch file should take you to
a message that tells you that you keyed in a directory name,
not a file name.

is this correct command?

IF EXIST filename. (
       del filename.
   ) ELSE (
       echo filename. MISSING.
   )

so kind of what I have is this:

cls
dir A:\ /a:-d /o:nr /b
pause
IF EXIST filename. (
       del filename.
   ) ELSE (
       echo filename. missing.
   )
:end

I RAN it and ran it and again but with no solution just errors been working on this alot. please any feedback.

Thanksi do not think first of all that DOS allow a minus switch

i looked on

http://www.easydos.com/dosindex.html

and did not see that switch  (-d)

i used to write code in clipper which is somewhat like c  and it looks as if you MIGHT be mixing up some other code with DOS.

i do not know if you cand do what you are setting out to do in a batch file.

you might have to go to debug.  sorry




Discussion

No Comment Found