• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Checking for Missing Parameters

Checking for Missing Parameters

Proper batch file techniques require you to check to see not only what a parameter is, but also whether one exists at all. This can be vital because a missing parameter can cause a batch file to crash and burn. For example, earlier I showed you a batch file called DONTCOPY.BAT designed to copy all files in the current folder to a new destination (given by the second parameter) except those you specified (given by the first parameter). Here’s the listing to refresh your memory:

@ECHO OFF
CLS
ATTRIB +H %1
ECHO.
ECHO Copying all files to %2 except %1:
ECHO.
XCOPY *.* %2
ATTRIB -H %1


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint