I’m trying to pass an asterisk symbol in quotes into my console app as a command line argument, and when I get it using System.Environment.getArgs, I actually get list of files in current directory. This is wrong, because I wrap asterisk into quotes, so text in quotes shouldn’t be substituted. How do I get command line arguments without such substitution in Windows under cygwin?
I’m trying to pass an asterisk symbol in quotes into my console app as
Share
If you enclose it in single quotes,
'*'it doesn’t get expanded, but the two inverted commas get through into the result ofgetArgs(see below), so you’d need to remove them later.The reason
"*"is expanded in windows is that inverted commas are legitimate as part of a globbable filename , because of spaces. You might want todel "temp file *.dat"at some point.gives: