Next code prints attributes of each file in current directory because of wildcard processing.
c:work>attrib *
I need to disable wildcard processing in my script. Escape symbols dont work:
c:work>attrib "*"
c:work>attrib ^*
Both give you the same.
I need to disable wildcard processing to start my application that accept wildcard as an argument.
A.java
import java.util.Arrays;
public class A {
public static void main(String[] args) {
System.out.println(Arrays.deepToString(args));
}
}
CMD
C:workemp>start.bat
C:workemp>java -cp playground.jar A *
[activation.jar, file.txt, playground.jar, playground.jar.bak, start.bat, test.bat]
C:workemp>start.bat
C:workemp>java -cp playground.jar A "*"
[activation.jar, file.txt, playground.jar, playground.jar.bak, start.bat, test.bat]
C:workemp>start.bat
C:workemp>java -cp playground.jar A "* foo? *bar*"
[* foo? *bar*]
Found workaround. "*;" - not falid folder name, but valid classpath:
java -cp "*;" A
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…