Searching, moving, copying, etc files with ampersand ( & ) in filename ?

R

Rob Stow

I often want to do things with files that have an "&" character
in the file name, but haven't been able to figure out how to do
so with either the command prompt or Explorer.

For example, searching for things like *&*.* or *^&*.* with
either Explorer or the Dir command shows ALL files, not just the
ones with an ampersand in the filename.
 
G

Gary Smith

Rob Stow said:
I often want to do things with files that have an "&" character
in the file name, but haven't been able to figure out how to do
so with either the command prompt or Explorer.
For example, searching for things like *&*.* or *^&*.* with
either Explorer or the Dir command shows ALL files, not just the
ones with an ampersand in the filename.

DIR *^&* works for me, as does DIR *^&*.*
 
R

Rob Stow

Gary said:
DIR *^&* works for me, as does DIR *^&*.*

Did a reboot and Dir *^&*.* started working for me - for a while.
Eventually it stopped working and I rebooted again.

Seems that searching for something with ^& in it with Explorer
doesn't work - and as soon as I do a search with ^& in Explorer,
I lose the ability to search for ^& in cmd.exe until I reboot.
I am at a loss to explain why cmd.exe should care the least bit
about what has been done with Explorer.
 
G

Gary Smith

Did a reboot and Dir *^&*.* started working for me - for a while.
Eventually it stopped working and I rebooted again.
Seems that searching for something with ^& in it with Explorer
doesn't work - and as soon as I do a search with ^& in Explorer,
I lose the ability to search for ^& in cmd.exe until I reboot.
I am at a loss to explain why cmd.exe should care the least bit
about what has been done with Explorer.

In Explorer, searching for *&* or just & gets me 47 hits, including the
two dummy files I created expecially for the test. Searching for *^&* or
just ^& finds nothing, which is what I expect since ^ is an escape
specific to CMD and has no special meaning to Explorer. In fact,
searching for ^ in Explorer gets me three hits, all shortcuts whose names
begin with "^ ".

Running these tests in Explorer had no effect on searching in cmd.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top