From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:4ef:: with SMTP id b15mr12852907qkh.662.1639042139846; Thu, 09 Dec 2021 01:28:59 -0800 (PST) X-Received: by 2002:a25:7613:: with SMTP id r19mr4875610ybc.498.1639042139674; Thu, 09 Dec 2021 01:28:59 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 9 Dec 2021 01:28:59 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=94.60.27.164; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY NNTP-Posting-Host: 94.60.27.164 References: <71f3752c-40a2-4678-9451-1223a776b384n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to call a Windows executable from Ada? From: Marius Amado-Alves Injection-Date: Thu, 09 Dec 2021 09:28:59 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63210 List-Id: Thanks all. Yeah, it's probably the quotation marks. I found no way around it with GNAT.OS_Lib. The quotes are needed because the names have spaces. Only way I found that works is with the command inside a .BAT file, then call that with GNAT.OS_Lib.Spawn Arguments : Argument_List := ( 1=> new String'("C:\Test\save_as_txt.bat"), 2=> new String'("") ); begin Spawn ( Program_Name => "C:\Test\save_as_txt.bat", Args => Arguments, Output_File_Descriptor => Standout, Return_Code => Result ); Also the BAT file *must* start with the magic incantation chcp 65001 on the first line, in order for the accented characters to work. So, a pragmatical solution exists, but ugly and irritating and hard to find. Hope these tips may save someone as many hours as I wasted with OS_Lib nonsense. Still a clean documented solution is to be found. Share your good code.