Hello all,

I'm in the process of writing an administrative kix script for setting up and scheduling defragmentation of specific files / folders for our admin team. My intent / goal with it is a script that will provide a prompt for which paths are to be defragmented and then a number of actions take place.

I'm not going to get into all the moving parts I'm planning, but the relatively simple parts of it are something I'm having some problems with.

Here is the code i'm currently struggling with:

 Code:
? "Enter paths to de-fragmented, separated by commas: "
Gets $PathInput
$PathInput = split($PathInput,",")
;
$Contig="C:\psscripts\contig\contig.exe -s"
$DefragCustomLog="C:\psscripts\contig\defraglog.txt"
;
;
For Each $Path in $PathInput
	? $Path
Next
;
For Each $Path in $PathInput
	shell "%ComSpec% /c $Contig $Path>>$DefragCustomLog"
Next


The above code will not work when a path with spaces is entered. Specifically, paths like C:\program files, won't work when typed in UNLESS they are put in quotes "C:\program files" or in non-8dot3 format (C:\progra~1).

I can work around that, but would love to know if there's someway I can code around it :).

I also am curious what can be done about the data entry prompt. At the prompt to enter paths, as soon as you reach the end of the dos line . . your characters start over-writing each other and it's really hard to know what's being typed. Is there possibly another way that I can leverage a prompt for users to be entering path data that would be easier for data entry?

thoughts and feedback appreicated,

Lan