Web Development with Visual FoxPro
Stop a single website from VFP program
Gravatar is a globally recognized avatar based on your email address. Stop a single website from VFP program
  Michael Hogan (Ideate Hosting)
  All
  May 14, 2026 @ 06:40am

I need to be able to stop a SINGLE website from a scheduled VFP exe for maintenance, pack a table, and start the website

From VFP I can use:

RUN /n4 IISRESET /Stop

...Pack my tables...

RUN /n4 IISRESET /Stop

...to stop ALL websites, but I'd rather do them one at a time.

I have tried similar to this to no avail:

lcCmd = [%windir%\system32\inetsrv\appcmd stop site /site.name:"Default Web Site"]

RUN /N4 &lcCmd

TIA

Gravatar is a globally recognized avatar based on your email address. re: Stop a single website from VFP program
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  May 14, 2026 @ 07:21am

The problem is the Environment variable in your command string:

%windir%\system32\inetsrv\appcmd stop apppool "MyAppPool"

You need to expand the environment variable before you RUN - RUN won't expand that. Also you have to run as Administrator.

Try this:

DO wwutils
IF !IsAdmin()
   WAIT WINDOW "Command requires admin rights." TIMEOUT 5
   RETURN
ENDIF

lcCmd = GetEnv("WinDir") + [\system32\inetsrv\appcmd stop APPPOOL "DefaultAppPool"]
RUN  /n4 &lcCmd

+++ Rick ---

© 1996-2026