viennawien Posted March 9, 2011 Posted March 9, 2011 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
allen2 Posted March 9, 2011 Posted March 9, 2011 (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 March 9, 2011 by allen2
Yzöwl Posted March 9, 2011 Posted March 9, 2011 You either:don't want any delimiters...FOR /F "DELIMS=" %%A IN ('DIR/S/B *.JAVA') DO ECHO=%%~dpnA...or you want all tokensFOR /F "TOKENS=*" %%A IN ('DIR/S/B *.JAVA') DO ECHO=%%~dpnA
viennawien Posted March 10, 2011 Author Posted March 10, 2011 Thank you allen2 and Wise Owl for your help. Now it works
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now