Lan,

Three points - First, you're better to use semicolons to delimit paths, as it's already a common method in the PATH statement. It pays to be consistent.

Second, you'd be better served to build the shell command in $Cmd, then run Shell $Cmd. This way, even for simple commands, you can dissect it and print it before you run it.

Third, use single quotes for Kix strings. DOS likes double quotes, and using single quotes in Kix allows you to easily embed double quotes in your commands that you Shell or Run.

So, try tyis:
 Code:
For Each $Path in $PathInput
  $Cmd = '%COMSPEC% /c '       ; note trailing space!
  $Cmd = $Cmd + $Contig + ' "' + $Path + '">>DefragCustomLog'
  'About to run:' @CRLF $Cmd @CRLF
  Shell $Cmd
This way, you see the command before you run it - you can verify that the path is properly surrounded with double quotes. When things work as desired, you can comment-out or remove the debug message (or - wrap it in an If $DEBUG command).

Glenn
_________________________
Actually I am a Rocket Scientist! \:D