Recent

Author Topic: External execution  (Read 1791 times)

DanishMale

  • Jr. Member
  • **
  • Posts: 73
External execution
« on: March 17, 2018, 01:08:33 am »
Can any help locating why this bit of code won't perform the unzip of an XZ-file with 7z, if called from Commandprompt it works perfectly:

7z e zippedfile_Deptartmentname.xz

The code doesn't give any errors but files are not extracted.


Code: Pascal  [Select][+][-]
  1.  UnZipper := TProcess.Create(Nil);
  2.  UnZipper.Options := UnZipper.Options+[poWaitOnExit,poNoConsole];
  3.  UnZipper.Executable := ExtractFilePath(Application.ExeName)+'\7z.exe';
  4.  for vI := 0 to HTTPdoc.Count - 1 do
  5.  begin
  6.     Unzipper.Parameters.Clear;
  7.     UnZipper.Parameters.Add('e');
  8.     UnZipper.Parameters.Add('zippedfile_'+HTTPdoc[vI]+'.xz');
  9.     UnZipper.Active := True;
  10.     UnZipper.Execute;
  11.     UnZipper.WaitOnExit;
  12.  end;
  13.  UnZipper.Free;
  14.  

Thanks in advance
« Last Edit: March 17, 2018, 01:21:21 am by DanishMale »
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: External execution
« Reply #1 on: March 17, 2018, 01:25:24 am »
Looks like a path issue..

The files to be unzipped, are they in the same path as the EXE ?

or maybe you can switch into the directory of the source files. CD /ChDir
The only true wisdom is knowing you know nothing

DanishMale

  • Jr. Member
  • **
  • Posts: 73
[SOLVED] Re: External execution
« Reply #2 on: March 17, 2018, 03:23:11 am »
Yes exe file is in same folder as the zipped files


Solution:
As jamie suggested it was a path issue
« Last Edit: March 17, 2018, 03:37:08 am by DanishMale »
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

 

TinyPortal © 2005-2018