In this embodiment, nothing happens, how to do it correctly tell me, please?

system(' @echo '); system(' P: '); system(' cd P:\A\ '); system(' rar.exe a -o+ -r P:\2.rar *.* '); 

It is necessary to convert the batch file code into delphi code. Thank.

  • 2
    Save the text of the batch file to a file, run the WinExec batch file, delete the batch file. - Nofate
  • > WinExec Do you like retro very much? ;-) - karmadro4

1 answer 1

  1. Create a text file shell.cmd
  2. Run it from the program body by calling ShellExecute, WinExec, CreateProcess.


 ShellExecute(0, nil, 'cmd.exe', '/C cd C:\shell.cmd', nil, WS_HIDE); 
  • and without a call to cmd or bat can not be? - Malus
  • See CreateProcess - alexlz
  • ShellExecute (0, 'open', 'E: \ ... \ Apt.bat', nil, nil, 1); did not fool around) - Malus