|
Answer» I have a little BATCH file that doesn't seem to recognize the long pathname. Looks like this... for %%f in (c:\Matt Files\*.dwg) do START /WAIT "c:\Program Files\AutoCAD 2006\acad.exe" %%f /b c:\AutoCAD Ref\LSP Files and Script Routines\Sript File Routines\TitleBlockReplace.scr
I get an error message "Windows canot find 'c:\Matt'. I'm new to this - sorry.Code: [Select]for %%f in ('dir /s /b "c:\Matt Files\*.dwg"') do START /WAIT "c:\Program Files\AutoCAD 2006\acad.exe" "%%f" /b "c:\AutoCAD Ref\LSP Files and Script Routines\Sript File Routines\TitleBlockReplace.scr"
Using quotes is recommended whenever the possibility exists that a path/filename will have embedded spaces.
I pasted your resonse - I got a response of...
Windows cannot find 'dir' and then Windows cannot find '/s' and then Windows cannot find '/b'
What else could be WRONG?
Rus7755Sorry about that:
Code: [Select]for /f %%f in ('dir /s /b "c:\Matt Files\*.dwg"') do START /WAIT "c:\Program Files\AutoCAD 2006\acad.exe" "%%f" /b "c:\AutoCAD Ref\LSP Files and Script Routines\Sript File Routines\TitleBlockReplace.scr"
Pasted it where? If using the code in a batch file, the code posted is CORRECT. If pasted at the command prompt, use single % symbols on the f variable (both of them).
I just pasted into notepad where the batch was written. I'm just double-clicking the file to execute it.
I don't understand the first /fdirectly after the FOR. Also the pathname for the directory of files to be used has a nest double quotes inside single quotes. Is that my mistake?
Thanks for the help, Rus7755Quote I don't understand the first /fdirectly after the FOR. Also the pathname for the directory of files to be used has a nest double quotes inside single quotes.
"c:\Matt Files\*.dwg" has embedded space(s) and therefore needs to be quoted.
The /f switch tells the for instruction that it will be processing a file-set (no quotes), a command (single quote), or a string (double quotes). In this case a command (dir) will be processed, therefore single quotes are needed.
This explains why you have a double quotes string nested in a single quote string. The paths after the wait switch and the /b switch also have embedded spaces. The %%f variable could go either way with spaces, so quoting the variable does no harm.
Is the code throwing an error or is everything fine?
It might be EASIER to debug your file if you run from the command prompt and not by double-clicking the file. For starters the cmd window will STAY open.
|