element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) Generate Gerber files with eaglecon.exe
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 3 replies
  • Subscribers 179 subscribers
  • Views 918 views
  • Users 0 members are here
Related

Generate Gerber files with eaglecon.exe

linhtf
linhtf over 7 years ago

I'm using Eagle 7.7.0 and making ulp file to generate all gerber/drill files.

My code is

 

int pos = strstr(EAGLE_PATH, "eagle.exe");

dir_eaglecon = strsub(EAGLE_PATH, 0, pos) + "eaglecon.exe";

dir_eaglecon = replace_string(dir_eaglecon , "/" , "\\" );

 

gerber_cmd = "cmd.exe /c " + dir_eaglecon;                                            

 

string s;

sprintf(s, "%s -X -dGERBER_RS274X -o\"%s\\%s%s\" \"%s%s\" %s", gerber_cmd, dir_gerber, release_name, gerberNames[i], dir_original, filename(B.name), gerberUsed[i]);

system(s);

 

it works perfectly with eaglecon.exe in C:\EAGLE-7.7.0\bin\

When I install program to C:\Program Files (x86)\EAGLE-7.7.0\bin\  ==> Error message: "...is not recognized as an internal or external command, operable program or batch file."

I'm aware that the new path of eaglecon.exe has "space" and need to be surrounded with quotation marks, so I update my code like:

 

gerber_cmd = "cmd.exe /c " + "\"" + dir_eaglecon + "\"";

 

However, the system(s) return 1 (Error) and cannot generate gerber file. In addition, when I manually type the command in cmd line, it also works perfectly with quotation surrounded eaglecon.exe path.

 

Please kindly help to get it works with my new program directory. I've tried setup new path in environment variables but does't work so far.

  • Sign in to reply
  • Cancel

Top Replies

  • autodeskguest
    autodeskguest over 7 years ago +2
    On 26/12/2017 12:04 a.m., Linh Pham wrote: I'm using Eagle 7.7.0 and making ulp file to generate all gerber/drill files. My code is int pos = strstr(EAGLE_PATH, "eagle.exe"); dir_eaglecon = strsub(EAGLE_PATH…
  • linhtf
    linhtf over 7 years ago in reply to linhtf +1 verified
    Hello again After read thoroughly the article from Warren, I understand and solve this issue. The correct way is using ^" to surrounding path. gerber_cmd = "cmd.exe /c " + "^\"" + dir_eaglecon + "^\""…
Parents
  • autodeskguest
    0 autodeskguest over 7 years ago

    On 26/12/2017 12:04 a.m., Linh Pham wrote:

    I'm using Eagle 7.7.0 and making ulp file to generate all gerber/drill files.

    My code is

     

    int pos = strstr(EAGLE_PATH, "eagle.exe");

    dir_eaglecon = strsub(EAGLE_PATH, 0, pos) + "eaglecon.exe";

    dir_eaglecon = replace_string(dir_eaglecon , "/" , "
    " );

     

    gerber_cmd = "cmd.exe /c " + dir_eaglecon;

     

    string s;

    sprintf(s, "%s -X -dGERBER_RS274X -o\"%s
    %s%s\" \"%s%s\" %s", gerber_cmd, dir_gerber, release_name, gerberNames[i], dir_original, filename(B.name), gerberUsed[i]);

    system(s);

     

    it works perfectly with eaglecon.exe in C:\EAGLE-7.7.0\bin\

    When I install program to C:\Program Files (x86)\EAGLE-7.7.0\bin\  ==> Error message: "...is not recognized as an internal or external command, operable program or batch file."

    I'm aware that the new path of eaglecon.exe has "space" and need to be surrounded with quotation marks, so I update my code like:

     

    gerber_cmd = "cmd.exe /c " + "\"" + dir_eaglecon + "\"";

     

    However, the system(s) return 1 (Error) and cannot generate gerber file. In addition, when I manually type the command in cmd line, it also works perfectly with quotation in eaglecon.exe path.

     

    Please kindly help to get it works with my new program directory. I've tried setup new path in environment variables but does't work so far.

     

    --

    To view any images and attachments in this post, visit:

    https://www.element14.com/community/message/232724

     

     

    .

    Hi

     

    Reading between the lines I suspect the spaces in the file path are

     

    Generally I use single quotes to surround the file paths with spaces in

    them. Not double quotes.

     

    so your line

    *gerber_cmd* = "cmd.exe /c " + dir_eaglecon;

    would become

    gerber_cmd = "cmd.exe /c " + "'" + dir_eaglecon + "'";

    ...or more elegantly......

    sprintf(gerber_cmd,"cmd.exe -c '%s'",dir_eaglecon);

     

     

     

    If you still have trouble post back here the resulting string 's'

    created by the sprintf.

     

    Have a read of this:

    https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/

     

    HTH

    Warren

    --

    ... use NNTP://news.cadsoft.de and a functional news reader like

    Thunderbird!

     

    ---

    This email has been checked for viruses by Avast antivirus software.

    https://www.avast.com/antivirus

     

     

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • linhtf
    0 linhtf over 7 years ago in reply to autodeskguest

    Hello Warren

     

    Both the single/double quotes don't work. Below is the output that I printed out .txt file. (I re-installed to C:\EAGLE-7.7.0, but still prefer to solve this issue for all users)

     

    EAGLE_PATH:

    C:/EAGLE-7.7.0/bin/eagle.exe

     

    EAGLECON_PATH:

    C:\EAGLE-7.7.0\bin\eaglecon.exe

     

    gerber_cmd:

    cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe'

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.cmp" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 1 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly2" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 2 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly3" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 3 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly4" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 4 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly5" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 5 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.sol" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 16 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.sol" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 16 17 18

    system(s): 1

     

     

    I also tried to copy-paste string 's' to cmd line, the result below:

    With single quotes '' - Syntax Error

    With double quotes "" - Worked

     

    image

     

    So I guess using double quotes is correct, but don't know why system(s) failed to execute the command.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • linhtf
    0 linhtf over 7 years ago in reply to autodeskguest

    Hello Warren

     

    Both the single/double quotes don't work. Below is the output that I printed out .txt file. (I re-installed to C:\EAGLE-7.7.0, but still prefer to solve this issue for all users)

     

    EAGLE_PATH:

    C:/EAGLE-7.7.0/bin/eagle.exe

     

    EAGLECON_PATH:

    C:\EAGLE-7.7.0\bin\eaglecon.exe

     

    gerber_cmd:

    cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe'

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.cmp" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 1 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly2" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 2 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly3" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 3 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly4" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 4 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.ly5" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 5 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.sol" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 16 17 18

    system(s): 1

     

    s: cmd.exe /c 'C:\EAGLE-7.7.0\bin\eaglecon.exe' -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.sol" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 16 17 18

    system(s): 1

     

     

    I also tried to copy-paste string 's' to cmd line, the result below:

    With single quotes '' - Syntax Error

    With double quotes "" - Worked

     

    image

     

    So I guess using double quotes is correct, but don't know why system(s) failed to execute the command.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • linhtf
    0 linhtf over 7 years ago in reply to linhtf

    Hello again

     

    After read thoroughly the article from Warren, I understand and solve this issue. The correct way is using ^" to surrounding path.

     

    gerber_cmd = "cmd.exe /c " + "^\"" + dir_eaglecon + "^\"";

     

    output:

    s: cmd.exe /c ^"C:\EAGLE-7.7.0\bin\eaglecon.exe^" -X -dGERBER_RS274X -o"C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-2\pcb\Gerber RS-274X\EPR100053-2.cmp" "C:\Users\linhpt\Desktop\EPR\EPR100053\EPR100053-1.3\EPR100053-1.3.brd" 1 17 18

    system(s): 0

     

    Thank you Warren!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube