I am having an issue with my program it should start the msconfig program when the button is pressed but it doesn't start, however when I change the file name to Cleanmgr it starts up perfectly.

ShellExecute(handle, 'open', PChar('cleanmgr'), nil, nil, SW_normal);

ShellExecute(handle, 'open', PChar('msconfig'), nil, nil, SW_normal);

I assumed it was the link so I changed it so that it links directly to the file using a fully qualified path.

ShellExecute(handle, 'open', PChar('C:\Windows\System32\msconfig.exe'), nil, nil, SW_normal);

Still no luck, what am I doing wrong?

I created a bat file with this in when I run the file directly it works.

@echo off
Start c:\windows\system32\msconfig.exe

When I call it from my program using the following,

ShellExecute(handle, 'runas', PChar('save.bat'), nil, nil, SW_normal);

it gives me the this error The system cannot find the file c:\windows\system32\msconfig.exe

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.