You should probably instead check whether you're under Unix, and if so, not attempt to fix wildcard arguments at all. Unlike under Windows derivatives, wildcard characters are valid parts of a filename in Unix, and actual wildcards are usually already expanded by the shell. If you get a filename with what appears to be a wildcard in it, you're probably not meant to expand it.