Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:34:06+00:00 2026-06-08T09:34:06+00:00

Next code prints attributes of each file in current directory because of wildcard processing.

  • 0

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:\work\temp>start.bat

C:\work\temp>java -cp playground.jar A *
[activation.jar, file.txt, playground.jar, playground.jar.bak, start.bat, test.bat]

C:\work\temp>start.bat

C:\work\temp>java -cp playground.jar A "*"
[activation.jar, file.txt, playground.jar, playground.jar.bak, start.bat, test.bat]

C:\work\temp>start.bat

C:\work\temp>java -cp playground.jar A "* foo? *bar*"
[* foo? *bar*]

Found workaround. “*;” – not falid folder name, but valid classpath:

java -cp "*;" A

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:34:07+00:00Added an answer on June 8, 2026 at 9:34 am

    As Ignacio Vazquez-Abrams already notes, on Windows the shell does not do wildcard expansion. That’s up to the application. So there is nothing you can do to the shell to stop it from doing something that it doesn’t do in the first place.

    > echoargs.exe *
    arg 1: *
    

    So if the arguments in your application are corrupted somehow, then it’s definitely not the shell’s fault.

    EDIT: Apparently Java "helpfully" copies the Unix behaviour and expands all wildcards for you. Above echoargs was written in C#, which is why the problem didn’t show.

    Ok, further digging reveals this bug report from 2004. This is because Java was linked with a different version of setargv, as described here on MSDN and thus expands wildcards in command-line arguments. This happens before Java even sees the arguments because this is the C runtime startup code.

    Furthermore, this is not documented anywhere as far as I could find, bug 5036373 linked above even notes that it should be documented. No fix for that, apparently. Even though it makes it impossible to pass a literal wildcard to Java programs. Apparently Windows is indeed just a second-class target for Java and they don’t care (or it would break too many programs, but I’m not sure there are that many that explicitly rely on this behaviour).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use next code to print current time Calendar cal = Calendar.getInstance(); System.out.println(cal.getTime()); I
I found out the next issue in this simple code: let () = print_endline
**the next code should parse a data from a webService to textView; Problem :
The next code runs normally in SQLSERVER but when i change the web.config to
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
Someone explain why the next code returns a pointer inside ntdll.dll? GetProcAddress(LoadLibraryA(kernel32.dll), EncodePointer); GetProcAddress(LoadLibraryA(kernel32.dll),
i have written the next code: public void delete(MyType instance) { List<MyType> myList =
Given the next code example, I'm unable to free the parameter const char* expression
I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {
I have the next code : public class AddPrinter extends ListActivity { @Override public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.