Scripts Thread, Long File Names in Batch File in Coding and Web Development; Hi Everyone I am trying to run the following batch file but keep getting errors. I know its to do ...
1. ## Long File Names in Batch File

Hi Everyone

I am trying to run the following batch file but keep getting errors.
I know its to do with spaces in long file names

batch file as follows:-

for /f %%a in (c:\Batch Files and Scripts\ping\c5.txt) do (ping %%a)

Where would i put the quotation marks?

Any help would be appreciated

Thanks

Barry Stone

2. In place of your first 2 brackets

"c:\Batch Files and Scripts\ping\c5.txt"

3. Hi Creese

Tried replacing backet for quotes, still wont run

Regards

Barry

4. Is your file extension .cmd or .bat? I also use .cmd

You could also put a 'pause' command at the end to see if there are any errors when running. Take it off when it runs okay.

5. don't replace the barackets add the inverted commas and keep the brackets

6. Creese

Its .bat

Barry

7. Originally Posted by barrystone
Creese

Its .bat

Barry
I prefer .cmd it's more flexible

8. 9/10 people prefer .cmd

Code:
```@echo off
cd /d "%~dp0"
for /f %%a in (c5.txt) do (ping %%a)```

10. Authur

Thanks

Code works OK

Regards

barry Stone

11. Creese

Regards

Barry Stone

12. Originally Posted by barrystone
Creese
I try :-)

13. Originally Posted by somabc
9/10* people prefer .cmd
* who expressed a preference.

14. Originally Posted by jinnantonnixx
* who expressed a preference.
So... I am a one in ten.....

15. Originally Posted by creese
So... I am a one in ten.....
No, you're one of nine of ten. Keep up now....

SHARE:
Page 1 of 2 12 Last