Good day, dear experts. Faced with the need to use the command windows console CMD. I call the necessary command using ShellExecute:

ShellExecute(0, 'open', 'cmd.exe', '/c regsvr32 /s some.dll', nil, SW_SHOW); 

The result is zero. I tried variations on the HInstance and Self.Handle themes as the first parameter, tried to wrap the parameters in PChar and PWideChar, nothing has changed: the cmd window appears, but does not get any instructions there. I decided that maybe I made a mistake in the cmd command itself, simplified the task:

 ShellExecute(0, 'open', 'cmd.exe', 'dir', nil, SW_SHOW); 

The result is the same. Tell me what's wrong

    1 answer 1

    As it turned out, the matter is in the keys. Structures

     ShellExecute(0, 'open', 'cmd.exe', '/k regsvr32 some.dll', nil, SW_SHOW); 

    and

     ShellExecute(0, 'open', 'cmd.exe', '/k dir', nil, SW_SHOW); 

    respectively. In general, the topic can be considered closed.