# Windows XP search help

**URL:** <https://boards.straightdope.com/t/windows-xp-search-help/430439>\
**Category:** Factual Questions\
**Created:** [December 18, 2007, 6:37am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439 "2007-12-18T06:37:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fern\_Forest](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@Fern\_Forest](https://boards.straightdope.com/u/Fern_Forest)\
**Post date:** [December 18, 2007, 6:37am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/1 "2007-12-18T06:37:01Z")

</div>

So I have many thousands of files and I want to make sure that each word in each file name starts with a capital letter. I know I once was able to search \* a\* (note the space before the a in the midst of the wild cards and every lowercase a preceded by a space was found. But now I can’t get it to work, it simply brings up all instances of the letter a. What did I do differently that one time to get it to work?

---

<div class="post-metadata">

**Author:** ![ChrisBooth12](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@ChrisBooth12](https://boards.straightdope.com/u/ChrisBooth12)\
**Post date:** [December 18, 2007, 6:42am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/2 "2007-12-18T06:42:31Z")

</div>

I am not sure if i understand you correctly. But i would recommend that you get GoogleDesktopSearch.

---

<div class="post-metadata">

**Author:** ![Fern\_Forest](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@Fern\_Forest](https://boards.straightdope.com/u/Fern_Forest)\
**Post date:** [December 18, 2007, 7:07am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/3 "2007-12-18T07:07:10Z")

</div>

I want to find all files with a lower case ‘a’ which have a space immediately before it.

I did it before but now I can’t get it to work.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 18, 2007, 11:45am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/4 "2007-12-18T11:45:31Z")

</div>

I don’t think you need the wildcards, because they are implied. I.e. in the “A word or phrase in the file:” box just put \<space\>a.

---

<div class="post-metadata">

**Author:** ![Fern\_Forest](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@Fern\_Forest](https://boards.straightdope.com/u/Fern_Forest)\
**Post date:** [December 18, 2007, 2:20pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/5 "2007-12-18T14:20:17Z")

</div>

[QUOTE=Usram]  
“A word or phrase in the file:” box just put \<space\>a.  
[/QUOTE]

Now it’s working. Thank you **Usram**. I kept putting things in “All or part of a file name” and it didn’t work.

---

<div class="post-metadata">

**Author:** ![JSexton](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@JSexton](https://boards.straightdope.com/u/JSexton)\
**Post date:** [December 18, 2007, 9:22pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/6 "2007-12-18T21:22:03Z")

</div>

Related: Is it possible to do a search and replace on file names in a given folder? Say I had a bunch of files with underscores, and I wanted to convert them to spaces. Possible?

---

<div class="post-metadata">

**Author:** ![MrSquishy](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@MrSquishy](https://boards.straightdope.com/u/MrSquishy)\
**Post date:** [December 18, 2007, 10:13pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/7 "2007-12-18T22:13:44Z")

</div>

[QUOTE=JSexton]  
Related: Is it possible to do a search and replace on file names in a given folder? Say I had a bunch of files with underscores, and I wanted to convert them to spaces. Possible?  
[/QUOTE]  
If you’re looking for an “easy” way (i.e. something built-in to the Windows GUI), I don’t think so.

I imagine you could do this with a batch file, or with Windows Script Host (whether that’s still included in XP, I’m not sure). Since my Windows batch file programming days are long behind me, I’ll leave it up to someone else to give you any further direction.

If you’re going to go the scripting route, and you don’t already know how to do it with DOS/cmd.exe, I think your best bet would be Python.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 18, 2007, 10:45pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/8 "2007-12-18T22:45:40Z")

</div>

Seconded. While it’s sometimes possible to do this sort of thing with .bat files it can involve extraordinary batch file gymanstics. Anything other than simple renaming is very difficult in the standard Windows shell. True scripting languages such as Python, Perl or VBscript make it much more straightforward.

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [December 19, 2007, 3:23am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/9 "2007-12-19T03:23:27Z")

</div>

[QUOTE=JSexton]  
Related: Is it possible to do a search and replace on file names in a given folder? Say I had a bunch of files with underscores, and I wanted to convert them to spaces. Possible?  
[/QUOTE]  
Paste the script below into a text file with a .cmd extension. Customize the value of the **folder** variable with the folder containing the files you want to rename. Double-clicking the script will rename the files.

```auto

@echo off
setlocal

set folder=c:\files

for /F "tokens=* usebackq" %%G in (`dir "%folder%" /A:-D /B`) do call :_process "%%G"
goto :eof

:_process
set newname=%~1
set newname=%newname:_= %
ren "%folder%\%~1" "%newname%"
goto :eof

```

---

<div class="post-metadata">

**Author:** ![JSexton](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@JSexton](https://boards.straightdope.com/u/JSexton)\
**Post date:** [December 19, 2007, 5:26am UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/10 "2007-12-19T05:26:46Z")

</div>

Fantastic! Thanks so much!

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 19, 2007, 12:57pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/11 "2007-12-19T12:57:43Z")

</div>

[QUOTE=Number]  
set newname=%newname:\_= %  
[/QUOTE]

Wow, I didn’t know that **set** could do search & replace. That’s actually pretty straightforward. I still say that the **for** command is a comprehensibility nightmare, though.

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [December 19, 2007, 1:37pm UTC](https://boards.straightdope.com/t/windows-xp-search-help/430439/12 "2007-12-19T13:37:36Z")

</div>

[QUOTE=Usram]  
Wow, I didn’t know that **set** could do search & replace. That’s actually pretty straightforward. I still say that the **for** command is a comprehensibility nightmare, though.  
[/QUOTE]  
It may be ugly but it is incredibly useful in batch scripting.

Some handy references:  
[FOR /F](http://www.ss64.com/nt/for_cmd.html)  
[Variable Search](http://www.ss64.com/ntsyntax/varsearch.html)  
[Parameters](http://www.ss64.com/ntsyntax/parameters.html)  
[SET](http://www.ss64.com/nt/set.html)
