Locate32 run from command-line and save results

User avatar
Cah
3StarLounger
Posts: 293
Joined: 26 Mar 2010, 10:53

Locate32 run from command-line and save results

Post by Cah »

Does anyone here use locate32 and if so knows how to get locate.exe (the command-line part of locate32, I think) to save results to a text file? I tried using locate /? to bring up the help but basically couldn't follow it, being very bad with such command syntaxt. Thnaks,

Chris

User avatar
StuartR
Administrator
Posts: 12612
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Locate32 run from command-line and save results

Post by StuartR »

Does the usual DOS trick of redirecting the output with > work?
StuartR


User avatar
HansV
Administrator
Posts: 78528
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Locate32 run from command-line and save results

Post by HansV »

Use the > operator to redirect output to a file, e.g.

locate.exe report.doc > c:\results\searchlog.txt

This will search for report.doc and instead of displaying the results in the command prompt window, will save them in the file searchlog.txt in the folder c:\results (which should already exist).
Best wishes,
Hans

User avatar
Argus
GoldLounger
Posts: 3081
Joined: 24 Jan 2010, 19:07

Re: Locate32 run from command-line and save results

Post by Argus »

Have you looked at this thread at Locate32 User Forums?
http://www.locate32.net/forum/viewtopic.php?f=6&t=133" onclick="window.open(this.href);return false;
There doesn't seem to be a switch for that; but what do I know, I don't use it.

But as mentioned by Stuart & Hans one can perhaps use the redirection operator to tell the command line what to do with it.
Byelingual    When you speak two languages but start losing vocabulary in both of them.

User avatar
Cah
3StarLounger
Posts: 293
Joined: 26 Mar 2010, 10:53

Re: Locate32 run from command-line and save results

Post by Cah »

Thanks everyone for the replies, I guess I was too tired when I was trying to make it work last night. I had tried using >. This morning I found that opening a command prompt in the locate.exe folder and typing the following works for searching a named database:

Locate -d "[Database Name]" -- [search term] > C:\Users\Public\Desktop\result.txt

Chris