I am trying in execute netsh winsock reset catalog
command in command prompt
from an elevated(has admin privileage) c++ application
.
HINSTANCE retVal = ShellExecute(NULL, "open", "cmd", "\c netsh winsock reset catalog > CUninstall.log", NULL, SW_NORMAL);
It just opens the command prompt and nothing else happens. I have tried
HINSTANCE retVal = ShellExecute(NULL, "runas", "cmd", "\c netsh winsock reset catalog > CUninstall.log", NULL, SW_NORMAL);
and
HINSTANCE retVal = ShellExecute(NULL, "open", "cmd", " netsh winsock reset catalog > CUninstall.log", NULL, SW_NORMAL);
Switch character was causing the problem. It worked when switch character was changed from \c
to /c
.
From
HINSTANCE retVal = ShellExecute(NULL, "open", "cmd", "\c netsh winsock reset catalog > CUninstall.log", NULL, SW_NORMAL);
to
HINSTANCE retVal = ShellExecute(NULL, "open", "cmd", "/c netsh winsock reset catalog > CUninstall.log", NULL, SW_NORMAL);