Ok, in that case the command should work. But have you traced it yourself (one of my recommendations)??
It gives an error 2 (file not found). Even though you provide a complete commandline, the command you give should be a program, not an internal command (which del is). If you put "cmd /c" before the commandline, it will work.
To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the following arguments: /c plus the name of the batch file.
lpCommandLine
The command line to be executed.
So it should point to a .exe. Windows itself strips the executable from the parameters and runs that executable. But "del" is not an executable but an internal command from cmd.exe.
So set lpApplicationName to "cmd.exe" and put "/c" in front of "del" or set "cmd /c" in front of the command, which works as well.
But I think it is a really bad way to do it like this. Why don't you just use DeleteFile(name + ':\a.txt'); ?
Works just as well with much less code (that can go wrong).