#124053 - 2004-07-28 02:13 PM
SHELL + ROBOCOPY + DIR with spacebar problem
|
Henry
Fresh Scripter
Registered: 2004-07-27
Posts: 6
|
Hi
Iīm doing some local drive file moves and make this script:
*************** $source = "c:\source_dir\" $destination = "c:\destination_dir\"
SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE $source $destination /E /MOVE /r:2 /w:2" ***************
It works fine with directories without spaces... But when trying to copy dir with spaces it wonīt work..
*************** $source = "c:\Documents And Settings\User.old\My Documents\" $destination = "c:\Documents And Settings\User.new\My Documents\"
SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE $source $destination /E /MOVE /r:2 /w:2" ***************
I have tryed CHR(34) etc. without succeed. So please, KixScript Guruīs, "Pimīp Up My Script"
Henry
|
Top
|
|
|
|
#124055 - 2004-07-28 02:35 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem
|
Henry
Fresh Scripter
Registered: 2004-07-27
Posts: 6
|
Not working, Source / Dest are mixed always wrong. Results from different variations below.
SHELL '%COMSPEC% /e:1024 /c ROBOCOPY.EXE "$source" "$destination" /E /MOVE /r:2 /w:2' ****************************************************************** ROBOCOPY :: Robust File Copy for Windows :: Version XP010 Started : Wed Jul 28 15:12:02 2004
Source : c:\source dir" c:\destination\ Dest : C:\kix\dir"\
Files : *.* Options : *.* /S /E /COPY:DAT /MOVE /R:2 /W:2
2004/07/28 15:12:02 ERROR 123 (0x0000007B) Accessing Source Directory c:\source dir" c:\destination\ The filename, directory name, or volume label syntax is incorrect. ******************************************************************
SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE "$source" "$destination" /E /MOVE /r:2 /w:2" ****************************************************************** ROBOCOPY :: Robust File Copy for Windows :: Version XP010 Started : Wed Jul 28 15:13:50 2004 Simple Usage :: ROBOCOPY source destination /MIR source :: Source Directory (drive:\path or \\server\share\path). destination :: Destination Dir (drive:\path or \\server\share\path). /MIR :: Mirror a complete directory tree. For more usage information run ROBOCOPY /? or read Robocopy.Doc. c:\source dir\ c:\destination dir\ /E /MOVE /r:2 /w:2 ******************************************************************
SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE '$source' '$destination' /E /MOVE /r:2 /w:2" ****************************************************************** ROBOCOPY :: Robust File Copy for Windows :: Version XP010 Started : Wed Jul 28 15:16:03 2004
Source - C:\kix\'c:\source\ Dest - C:\kix\dir\'\
Files : Options : /COPY:DAT /R:1000000 /W:30 ERROR : Invalid Parameter #3 : "'c:\destination" Simple Usage :: ROBOCOPY source destination /MIR source :: Source Directory (drive:\path or \\server\share\path). destination :: Destination Dir (drive:\path or \\server\share\path). /MIR :: Mirror a complete directory tree. For more usage information run ROBOCOPY /? or read Robocopy.Doc. ******************************************************************
|
Top
|
|
|
|
#124058 - 2004-07-28 03:12 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem
|
Henry
Fresh Scripter
Registered: 2004-07-27
Posts: 6
|
Sorry... my mistake..
**************************************
$source = "c:\source dir\" $destination = "c:\destination dir\"
; 1 attempt ;SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE $source $destination /E /r:2 /w:2"
; 2 attempt ;SHELL '%COMSPEC% /e:1024 /c ROBOCOPY.EXE "$source" "$destination" /E /MOVE /r:2 /w:2'
; 3 attempt ;SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE "$source" "$destination" /E /MOVE /r:2 /w:2"
; 4 attempt SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE '$source' '$destination' /E /MOVE /r:2 /w:2"
**************************************
|
Top
|
|
|
|
#124062 - 2004-07-28 06:09 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem
|
Chris_Wood
Lurker
Registered: 2004-07-28
Posts: 4
Loc: Indianapolis
|
$Source = CHR(34)+"C:\source dir"+CHR(34) $Destination =CHR(34)+"C:\destination dir"+CHR(34) SHELL "%COMSPEC% /e:1024 /c ROBOCOPY.EXE $source $destination /E /MOVE /r:2 /w:2"
CHR(34) is ASCII for the double quotes
Hope this helps, Chris
|
Top
|
|
|
|
#124064 - 2004-07-28 08:10 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem resolved
|
Henry
Fresh Scripter
Registered: 2004-07-27
Posts: 6
|
Thanks to everybody for good ideas, this was the working one: ************************* ; SHELL + ROBOCOPY + DIR with spacebars solution
$source = '"c:\My Old Documents"' $dest = '"c:\My New Documents"'
SHELL 'ROBOCOPY.EXE $source $dest /E /MOVE /r:2 /w:2' *************************
|
Top
|
|
|
|
#124066 - 2004-07-28 09:55 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem resolved
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Shell calls often suck. I guess it's because of the mixed environments.
A trick that i use is to simply dislay the shell command to the screen, Just prefix the command with a '?'and put the lot in single quotes, this way yu can see exactly what the %comspec% will see.
You can then copy/past the displayed line to your command prompt and see any errors.
acmp<><
_________________________
Every day is a school day
|
Top
|
|
|
|
#124067 - 2004-07-28 09:57 PM
Re: SHELL + ROBOCOPY + DIR with spacebar problem resolved
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
What's the big problem with vars in strings?
With shell commands they can often be the 'most convenient' soloution.
acmp<><
_________________________
Every day is a school day
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 515 anonymous users online.
|
|
|