Page 1 of 1 1
Topic Options
#196815 - 2009-11-23 10:02 PM Command line works but not from script
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
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.

 Code:
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
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196817 - 2009-11-24 12:01 AM Re: Command line works but not from script [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
You can't redirect without invoking %COMSPEC% /c, you silly programmer! ;\)
 Code:
	$shellline = '%COMSPEC% /c d:\finddupe\finddupe.exe "' + $folder + '\**" >"d:\finddupe\duplicates_' + $folder.name + '.txt"'

G-
_________________________
Actually I am a Rocket Scientist! \:D

Top
#196818 - 2009-11-24 12:22 AM Re: Command line works but not from script [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
!##@%%#!%^%$$@#

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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196825 - 2009-11-24 02:45 PM Re: Command line works but not from script [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
It sucks when you can't see the data array for all the bits, eh? ;\)

G-
_________________________
Actually I am a Rocket Scientist! \:D

Top
#196827 - 2009-11-24 02:57 PM Re: Command line works but not from script [Re: Glenn Barnas]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
"Elements", surely?
Top
#211947 - 2016-09-12 12:13 PM Re: Command line works but not from script [Re: Richard H.]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
LOL \:o 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
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#211954 - 2016-09-16 09:17 PM Re: Command line works but not from script [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well if it's after 30's what about those near 60
Top
#211955 - 2016-09-17 01:35 AM Re: Command line works but not from script [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Hey! Who you calling ol - er - um - (nevermind). \:D
_________________________
Actually I am a Rocket Scientist! \:D

Top
#211956 - 2016-09-17 01:56 AM Re: Command line works but not from script [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Mart you silly boy
_________________________
!

download KiXnet

Top
#213675 - 2019-04-29 07:47 PM Re: Command line works but not from script [Re: Lonkero]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Good too see that you fixed it ;).
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 410 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.071 seconds in which 0.03 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org