In Office programs, you receive a "Specified COMMAND search directory had too many parameters" error message when you try to use an MS-DOS core command from the Shell function (213800)
The information in this article applies to:
- Microsoft Office Access 2003
- Microsoft Access 2002
- Microsoft Access 2000
- Microsoft Access 97
- Microsoft Office Excel 2003
- Microsoft Excel 2002
- Microsoft Excel 2000
- Microsoft Excel 97 for Windows
- Microsoft Office PowerPoint 2003
- Microsoft PowerPoint 2002
- Microsoft PowerPoint 2000
- Microsoft PowerPoint 97 for Windows
- Microsoft Office Word 2003
- Microsoft Word 2002
- Microsoft Word 2000
- Microsoft Word 97 for Windows
This article was previously published under Q213800 SYMPTOMS
In Microsoft Office, when you use the Shell function in a Visual Basic for Applications macro to execute an external MS-DOS command, an MS-DOS window may open and you may receive the following error message:
Specified COMMAND search directory had
Too many parameters
The MS-DOS window is fully functional and the command you were attempting to run from the macro can be successfully run from the MS-DOS prompt.
The commands that return this error message are the following:
- DIR
- CLS
- DEL
- CD
- MD (MKDIR)
- RD (RMDIR)
- COPY
CAUSE
This behavior occurs if you have not used the /c switch in the macro. The /c switch is required to properly execute MS-DOS commands in a Visual Basic for Application macro.
RESOLUTION
To resolve this behavior, add the /c switch after command.com. For example to create a new directory called mydir, use the following code in a macro:
Shell "command.com /c md c:\mydir"
Note the /c switch after command.com.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbdtacode kberrmsg kbprb kbProgramming KB213800 |
---|
|