Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AcCoreConsole Batch

5 REPLIES 5
Reply
Message 1 of 6
townest
2183 Views, 5 Replies

AcCoreConsole Batch

Hello,

 

I have written a the following batch .bat file to loop through a directory, find all 'current' folders, then run a script:

 

FOR /R C:\Drawings\test\testscr %%f in (current\*.dwg) do start /wait C:\"Program Files"\"Autodesk"\"AutoCAD 2019"\acad.exe "%%f" /b C:\Drawings\test\pasteblock.scr 

 

The above .bat works but I would rather use AcCoreConsole to speed things up.  How can I convert this .bat file to run AcCoreConsole?  Just replacing .exe files, shown following, didn't take.

 

FOR /R C:\Drawings\test\testscr %%f in (current\*.dwg) do start /wait C:\"Program Files"\"Autodesk"\"AutoCAD 2019"\AcCoreConsole.exe "%%f" /b C:\Drawings\test\pasteblock.scr 

 

Thank you!

 

Tyler

Acad2019

 

5 REPLIES 5
Message 2 of 6
townest
in reply to: townest

Just an additional clarification.  The .bat above runs through sub-directories also, taken from page 6 of http://www.widom-assoc.com/AU-CP12-3L.pdf, which looks a little different than just looping through a single dir.

Message 3 of 6
_gile
in reply to: townest

Hi,

 

You should have a look at this topic.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 6
_gile
in reply to: _gile

Try something like this (change the paths to suit your needs).

 

echo off

:: Path to AutoCAD core console
set accoreexe="C:\Program Files\Autodesk\AutoCAD 2019\accoreconsole.exe"

:: Path the directory to process
set "source=C:\Drawings\test\testscr"

:: Path to the script to run
set script="C:\Drawings\test\pasteblock.scr"

FOR /f "delims=" %%f IN ('dir /b "%source%\*.dwg"') DO %accoreexe% /i "%source%\%%f" /s %script%

:: comment the following to automatically close the console when batch ends
pause


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 6
townest
in reply to: _gile

Thanks for your input.  I got it to work with:

 

FOR /R C:\Drawings\test\testscr %%f in (current\*.dwg) do "C:\Program Files\Autodesk\AutoCAD 2019\accoreconsole.exe" /i "%%f" /s "C:\root_deleteme\pastelines.scr" /l en-US

 

My primary issues was with network directories.  After pulling the .scr and .bat out of the network drive, it worked.

 

But now I have a new challenge.  Turns out not all the sub-directories are named "current" but all do have the name "current" (eg. current001, current002).  So I tried the following with no luck.  It found 0 files.

 

FOR /R F:\Drawings\test\testscr %%f in (current*\*.dwg) do.......

 

It looks like windows doesn't like the wildcard * with a backslash or something.   Any ideas on syntax for wildcards in sub-directories? 

 

Thank you.

 

Message 6 of 6
cgilmer
in reply to: townest

I had syntax trouble with this same exercise.  My issue was spaces in the path or filename and was resolved by enclosing the full path to the [.dwg, .exe, .scr] in double quotes, as seen below:

 

FOR /f "delims=" %%f IN ("drv:\folder\folder\folder\file name.dwg") DO "drv:\folder\the folder\folder\accoreconsole.exe" /i "%%f" /s "drv:\folder\some folder\folder\file.scr" /l en-US

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost