Jump to content

Recommended Posts

Posted

If I run this:

for /F %%a in ('dir /S/B *.java') do ( echo %%~dpna)

in a directory with spaces , like "My Documents", the echo truncates the name to the first space.

Thank you for your help


Posted (edited)

Change it to this:

for /F "delims=; " %%a in ('dir /S/B *.java') do ( echo %%~dpna)

I used ";" as delimiter as it can't be used in filename or path.

Edited by allen2
Posted

You either:

don't want any delimiters...

FOR /F "DELIMS=" %%A IN ('DIR/S/B *.JAVA') DO ECHO=%%~dpnA

...or you want all tokens

FOR /F "TOKENS=*" %%A IN ('DIR/S/B *.JAVA') DO ECHO=%%~dpnA

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...