add support for files and paths that have spaces.

This change leaves paths with spaces alone (while wrapping in quotes for command), while replacing spaces with underscores in the actual filename.