I want to invoke a Windows command from Java.
Using the following line works fine:
ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/C",
"find \"searchstr\" C://Workspace//inputFile.txt");
But I want to find the string in all text files under that location, tried it this way,
ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/C",
"find \"searchstr\" C://Workspace//*.txt");
But it does not work and there is no output in the Java console.
What's the solution?
find "searchstr" C://Workspace//*.txt
work from the windows command prompt? If the path doesn't exist it gives me a 'File not found' message in the first case but with the wildcard it hangs. – Fermi