$cmd = quotemeta($cmd); RESULT: cmd = dir\ \/b\ L\:\\Dir\\To\\Scan\\\*\.bat Parameter format not correct - "b\".