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 ...
-
11th July 2011, 02:21 PM #1
- Rep Power
- 0
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
-
-
IDG Tech News
-
11th July 2011, 02:23 PM #2 In place of your first 2 brackets
"c:\Batch Files and Scripts\ping\c5.txt"
Last edited by creese; 11th July 2011 at 02:25 PM.
-
-
11th July 2011, 02:36 PM #3
- Rep Power
- 0
Hi Creese
Tried replacing backet for quotes, still wont run
Regards
Barry
-
-
11th July 2011, 02:37 PM #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.
-
-
11th July 2011, 02:39 PM #5 don't replace the barackets add the inverted commas and keep the brackets
-
-
11th July 2011, 02:39 PM #6
- Rep Power
- 0
-
-
11th July 2011, 02:40 PM #7 
Originally Posted by
barrystone
Creese
Its .bat
Barry
I prefer .cmd it's more flexible
-
-
11th July 2011, 02:58 PM #8
-
-
11th July 2011, 05:30 PM #9 Try this instead...
Code:
@echo off
cd /d "%~dp0"
for /f %%a in (c5.txt) do (ping %%a)
-
-
12th July 2011, 11:23 AM #10
- Rep Power
- 0
Authur
Thanks
Code works OK
Regards
barry Stone
-
-
12th July 2011, 11:24 AM #11
- Rep Power
- 0
Creese
Thanks for all your help
Regards
Barry Stone
-
-
12th July 2011, 11:25 AM #12 
Originally Posted by
barrystone
Creese
Thanks for all your help
I try :-)
-
-
12th July 2011, 11:30 AM #13 
Originally Posted by
somabc
9/10* people prefer .cmd
* who expressed a preference.
-
-
12th July 2011, 11:37 AM #14 
Originally Posted by
jinnantonnixx
* who expressed a preference.
So... I am a one in ten.....
-
-
12th July 2011, 11:39 AM #15 
Originally Posted by
creese
So... I am a one in ten.....
No, you're one of nine of ten. Keep up now....
-
SHARE: 
Similar Threads
-
By El_Nombre in forum How do you do....it?
Replies: 3
Last Post: 23rd June 2011, 02:05 PM
-
By fil_b in forum Windows Server 2000/2003
Replies: 5
Last Post: 5th November 2009, 04:13 AM
-
By karldenton in forum Windows
Replies: 16
Last Post: 22nd July 2009, 12:47 PM
-
By cheryl in forum Windows
Replies: 2
Last Post: 18th January 2008, 10:27 PM
-
By beeswax in forum Scripts
Replies: 9
Last Post: 3rd March 2006, 07:48 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules