For some reason or another I took a job that involves building good old-fashioned batch files to get things done. We are running into some problems that involve parameters containing spaces and error handling in batch files.

1) the second variable is a path variable and it works fine if we use a path like C:\Data\Backups but if we use a parameter like C:\Program Files\Data then the process ends up getting C:\Program as the variable and errors because it doesn't recognize Files\Data. Have tried wrapping it in quotes and double quotes but then it just causes an error when the value is referenced later on.

2) The error handling within batch files is also a problem. I want it to stop processing when an error occurs but using the ErrorLevel variable I always get the value 1 returned. Does anyone know what the ErrorLevel means and how to use it?