Using the XP Web Publishing Wizard, minus the cruft

I’m a big fan of the XP’s Web Publishing Wizard. Anything that will allow a completely non-tech-savvy person the ability to upload photos to a website (specifically a Coppermine photo gallery) in just a few seconds is okay in my book. But … the problem is that it doesn’t work all that well when you have the silly web stuff turned off in XP. You know what I’m talking about: those little context-sensitive windows to the left of your Explorer windows that XP likes to clutter up the place with. If you turn them off, then you can’t easily get to the Web Publishing Wizard.

SendTo folder with Web Publishing Wizard Shortcut

After a bit of digging I was able to find that you can run the WPW via a DLL call and rundll32, but simply passing in a target file or folder doesn’t work right. (I presume it has something to do with the fact that it expects that info via DDE instead of the command-line, but I haven’t looked into it that much yet.) Basically, it’ll always load up in “My Documents” instead of wherever you tell it to. So, you need to hack things around a little bit to make it work.

Before I go on to explain how to do it and how it works, let me put something in big red letters: This seriously screws with your machine and can leave it in a very messed-up state. Don’t do it unless you understand what it is doing.

With that said:

  1. Create a new batch file named “wpw.bat” and save it somewhere useful.
  2. Edit that file and paste in this code:
    @ECHO OFF
    SETLOCAL
    PUSHD %1 2> nul
    IF errorlevel 1 GOTO IsFile
    :IsDir
    SET TARGET=%~1
    GOTO FoundTarget
    :IsFile
    SET TARGET=%~dp1
    PUSHD %TARGET%
    :FoundTarget
    SET HAS_COOKIES=0
    SET HAS_LOCALSETTINGS=0
    IF EXIST "%TARGET%\\Cookies" SET HAS_COOKIES=1
    IF EXIST "%TARGET%\\Local Settings" SET HAS_LOCALSETTINGS=1
    ECHO Target: %TARGET%
    ECHO Cookies: %HAS_COOKIES%
    ECHO Local Settings: %HAS_LOCALSETTINGS%
    MKDIR "%TARGET%\\Cookies"
    SET TEMPPROFILE=%USERPROFILE%
    SET USERPROFILE=%TARGET%
    REG ADD "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d "%%USERPROFILE%%" /f
    rundll32 netplwiz.dll,PublishRunDll
    SET USERPROFILE=%TEMPPROFILE%
    REG ADD "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d "%%USERPROFILE%%\\My Documents" /f
    IF %HAS_COOKIES%==0 rmdir /s /q "%TARGET%\\Cookies" 2> nul
    IF %HAS_LOCALSETTINGS%==0 rmdir /s /q "%TARGET%\\Local Settings" 2> nul
    POPD
    ENDLOCAL
  3. Create a shortcut to that batch file, and put it in “c:\Documents and Settings\[your username]\SendTo\“. Rename the shortcut, not the batch file, to “Web Publishing Wizard”.
    SendTo folder with Web Publishing Wizard shortcut
  4. Give it a pretty icon by right-clicking it, going into Properties, and selecting Change Icon. Start it minimized by choosing the “Minimized” option in the Run dropdown.
    Web Publishing Wizard shortcut properties
  5. Right click any image or folder, go down to Send To, and you should now have a “Web Publishing Wizard” option that should work just like it did before. If it doesn’t, post a comment here and we’ll see if we can’t figure out why.
    Web Publishing Wizard option in Send To context menu

How it works:

Since we know that the WPW wants to start up in your My Documents folder, we use that and temporarily move your profile to accommodate that. We do this by setting an environment variable and a registry key to make it look like your My Documents folder is the one that has the pictures in it. We then call the WPW, then put everything back the way we found it when it is finished.

There’s some extraneous stuff in there about Cookies and Local Settings. We do that because when you move the My Documents folder Windows will automagically give it Cookies and Local Settings folders. We don’t want every folder on our hard drive to magically get those extra folders, so we keep track of if the folder had them before we started, then delete them afterwards if not.

The inherent safety problem here is thus: this process is in no way reentrant. You should not do absolutely anything else while you are using this hack. Start the wizard, upload your files, then make sure all the related windows close before you do anything else. Do not alt-tab, do not blur, do not collect $200.

Published by

Rick Osborne

I am a web geek who has been doing this sort of thing entirely too long. I rant, I muse, I whine. That is, I am not at all atypical for my breed.