Mart
|
(KiX Supporter)
|
2009-11-23 10:02 PM
|
|
|
|
|
Command line works but not from script
|
|
Guy's,
This has me puzzled for the last few hours and I just cannot see what is wrong. I want to use finddupe.exe to find duplicate files in a bunch of folders. I use the DirPlus UDF to get a list of of folders in a specific location. These folders can have spaces in the names so I need to preserve those to get correct results. The script below gets me the correct command line results on the screen. I copied and pasted each $shellline in a command windows and all executed correctly. Running them from a script makes finddupe.exe not interpret the redirect to a file correct. It must be something with the quotes but I tried so many variations that I cannot see the correct one anymore.
Break on
$rc = SetOption("WrapAtEOL", "On")
$folders = dirplus("d:\finddupe\test test\", "/ad")
For Each $folder in $folders
$shellline = 'd:\finddupe\finddupe.exe ' + '"' + $folder + '\**" >"d:\finddupe\duplicates_' + $folder.name + '.txt"'
? $shellline
?
Shell $shellline
Next
|
|
Re: Command line works but not from script
|
|
You can't redirect without invoking %COMSPEC% /c, you silly programmer!
$shellline = '%COMSPEC% /c d:\finddupe\finddupe.exe "' + $folder + '\**" >"d:\finddupe\duplicates_' + $folder.name + '.txt"' G-
|
Mart
|
(KiX Supporter)
|
2009-11-24 12:22 AM
|
|
|
|
|
Re: Command line works but not from script
|
|
!##@%%#!%^%$$@#
I knew it was something stupid. That's what you get for looking at the code waaaaay to long. I knew about %compes% for redirecting output just did not notice the absence of it.
Thanks for the reminder Glenn, all works just fine now.
|
|
Re: Command line works but not from script
|
|
It sucks when you can't see the data array for all the bits, eh?
G-
|
|
Re: Command line works but not from script
|
|
"Elements", surely?
|
Mart
|
(KiX Supporter)
|
2016-09-12 12:13 PM
|
|
|
|
|
Re: Command line works but not from script
|
|
LOL This one saved my day again. One would assume that this is something easy to remember but I guess memory starts shutting down when the 30's are over LOL
|
NTDOC
|
(KiX Master)
|
2016-09-16 09:17 PM
|
|
|
|
|
Re: Command line works but not from script
|
|
Well if it's after 30's what about those near 60
|
|
Re: Command line works but not from script
|
|
Hey! Who you calling ol - er - um - (nevermind).
|
Lonkero
|
(KiX Master Guru)
|
2016-09-17 01:56 AM
|
|
|
|
|
Re: Command line works but not from script
|
|
Mart you silly boy
|
Björn
|
(Korg Regular)
|
2019-04-29 07:47 PM
|
|
|
|
|
Re: Command line works but not from script
|
|
Good too see that you fixed it ;).
|