You are right, it doesn't work under windows with echo, only under
unix/linux.
The following C program demonstrates that Windows does expand *:
#include<stdio.h>
int main(int argc, char **argv) {
int i;
for(i = 0; i < argc; i++) {
printf("arg %d = %s\n", i+1, argv[i]);
}
return 0;
}
As does the following Java program:
public class Test {
public static void main(String[] args) {
for(int i = 0; i < args.length; i++) {
System.out.println("arg " + (i+1) + " = " + args[i]);
}
}
}
CD Rasmussen wrote:[color=blue]
> Not under XP Pro.
> echo *
> prints "*"
> Wild card expansion has never been a function of batch but is done by
> whatever is run under batch, see the "for" command in batch for this.
>
> Constantine
>
> mhandis wrote:
>[color=green]
>> Your statement: "inspite of Windows not expanding shell wildcards" is
>> not true. Windows does expand the wildcard, just like bash or csh
>> (unix) does.
>>
>> If you want to see what is actually being passed in, echo it:
>> echo java MyClass *
>>
>> Echo works on both Windows and unix as well.
>>
>> So this has nothing to do with Java at all.
>>
>> Bharath Dhurjati wrote:
>>[color=darkred]
>>> Hello,
>>>
>>> I am looking for documentation that specifies the following behavior
>>> exhibited by java.
>>>
>>> The following (assuming MyClass.class is accessible and has a main())
>>>
>>> java MyClass *
>>>
>>> yields the same result on Windows as on Unix, inspite of Windows not
>>> expanding shell wildcards. Basically, the args[] passed to main()
>>> contains names of files in that directory.
>>>
>>> The basic behavior is documented in the following link:
>>>
http://groups.google.com/groups?hl=e...argate.sgi.net
>>>
>>>
>>> The last post by Kevin Kelley points this as 'specified' behavior for
>>> java.exe.
>>>
>>> The following link also points this as specified behavior.
>>>
http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
>>>
>>> Now I am trying to find out exactly WHERE is this specified.
>>> I have run searches on java.sun.com and used their documentation
>>> searcher also, but couldn't find any documentation.
>>>
>>> Can some one please help?
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Bharath.[/color][/color]
>
>[/color]