Looks like you forgot a space after cmd.exe.
Main Topics
Browse All TopicsHi;
I want use this dos command "del/s c:\*.kek" on delphi form.
this code "WinExec(pchar('C:\WINDOWS
How i can fix this problem
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
create a batch file first
procedure TForm1.CreateBatchDelete(F
var List: TStringList;
begin
List := TStringList.Create;
try
List.Add('del /s c:\*.kek');
// add /q for quiet mode
// add /f to force delete read only files
List.SaveToFile(FileName);
finally
List.Free;
end;
end;
to run the batch, use this:
uses ShellApi;
procedure TForm1.RunBatch(FileName: string);
begin
ShellExecute(0, 'open', FileName, nil, nil, SW_HIDE);
end;
to start it all:
procedure TForm1.Button1Click(Sender
var FileName: string;
begin
FileName := ChangeFileExt(ParamStr(0),
CreateBatchDelete(FileName
RunBatch(FileName);
end;
Here:
http://www.delphitricks.co
just change file name and supply path...
Here's a Delphi procedure that can delete a file with the ability to undo by sending the file to the "Recycle Bin."
Function FileDeleteRB will return True if the operation was successful.
~~~~~~~~~~~~~~~~~~~~~~~~~
uses ShellAPI;
function FileDeleteRB(
AFileName:string): boolean;
var Struct: TSHFileOpStruct;
pFromc: array[0..255] of char;
Resultval: integer;
begin
if not FileExists(AFileName) then begin
Result := False;
exit;
end
else begin
fillchar(pfromc,sizeof(pfr
StrPcopy(pfromc,expandfile
Struct.wnd := 0;
Struct.wFunc := FO_DELETE;
Struct.pFrom := pFromC;
Struct.pTo := nil;
Struct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION
or FOF_SILENT;
Struct.fAnyOperationsAbort
Struct.hNameMappings := nil;
Resultval := ShFileOperation(Struct) ;
Result := (Resultval = 0) ;
end;
end;
Business Accounts
Answer for Membership
by: mokulePosted on 2009-10-12 at 12:31:58ID: 25554235
Hi,
There are many solutions.
One is to create bat file containig this command and execute it.
regards
mokule