Make cd command work with spaces
Throw away your current code. Instead write this:

for dir in *; do
  (cd "./$dir" &amp;&amp; echo "In $(exec pwd) now.")
done


As a general rule, always put variables into quotes.

Rationale: Your current code can handle a few cases properly, but some other special characters will still be interpreted specially by the shell and lead to unexpected behavior. Therefore the proper way to work around this problem is to write cd ' into the terminal, then to paste the path and then to finish the command by typing '. This will work for all characters except single quotes.

Alternatively, you could invent a command cdclip that changes to the path in the clipboard. Cygwin has /dev/clipboard, and on native Linux there is probably some similar way to read the clipboard contents.