General discussion


DOS Bat with %1 - How to detect this as Error in Bat file?

By ken.roberts ·
I have a simple DOS batch file, "copyin.bat" that has one variable, which is referenced by %1. The variable is the user's own directory on our server. So if John wants to copy in my files to his directory, he just enters: "copyin John".

However, sometimes the user will forget and just run the batch file without the variable, typing in "copyin" all by itself. How can I use the ErrorLevel variable or some other method to detect this and then issue this:

Echo You forgot to enter your Name - please rerun the program

Any ideas?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums