I have read this documentation including the section that exemplifies Command Line Argument Files but can't figure out how to get it working in PowerShell. Here's what I have done:
First, I can compile a Driver.java file using (in windows PowerShell, javac version 17.0.3):
>>javac Driver.java
But, I would like to figure out how to use argument files (@filename
).
I have tried to create a file called files.txt
with 1 entry in it listed as Driver.java
and then use javac with @file to specify what to compile:
PS-pluto>>dir -n *.java >files
PS-pluto>javac @files
I tried creating files
, and files.txt
. Driver.java is definitely the entry, but the javac command doesn't work. I am running this from the folder where files and Driver are located.
I read the answer to this question which indicated that I needed to add quotes, and tried this (again, with and without .txt):
PS-pluto>>dir -n *.java >files
PS-pluto>>javac "@files"
This may work, but doesn't solve the problem. Now I get a new error:
error: invalid flag: ■Driver.java
I have looked for hidden formatting in my txt file and only see the line return at the end of Driver.java. Not sure what is wrong?
I know in this simplistic case using an argument file is overkill, but I am simply trying to figure out how it works...and cannot.
NOTE: I already know how to compile this in an IDE or with a build tool. I am trying to figure out how to do this in PowerShell, and admittedly, I am a novice PowerShell user.