Blog

Using the Windows Command Line to Automate Edits
Posted on March 3, 2014 in Command Line, Windows by Matt Jennings

Note: These commands use Command Prompt, the default shell on Windows. I use them all the time to do small website edits at my job.

Steps to Automate Small Edits on Websites

  • Download Notepad++, an excellent free text editor to complete this tutorial.
  • Download the updates.zip directory that contains files you’ll need here and move it to your Desktop.
  • After unzipping the updates.zip directory that you downloaded, you’ll see additional files inside as shown below:
    ---updates
    ------aaa-working
    ------backup
    ------resources
    ------www
    ------zzz01_bckup_to_wking.bat
    ------zzz01_wking_to_www.bat
    ------zzzz_____spacer03.bat
    ------zzzz_____spacer04.bat
    ------ZZZZZZ__DESTOYER.bat
  • Inside the updates directory, right-click zzz01_bckup_to_wking.bat and left-click Edit with Notepad++ from the menu that appears so you can edit the file.
  • Inside zzz01_bckup_to_wking.bat replace username with your Windows username. If you’re on a work computer and your name is Jane Doe it’ll be something like jdoe.
  • Follow the same process to change the username text in all the other .bat files EXCEPT for zzzz_____spacer03.bat and zzzz_____spacer03.bat.
  • Put a file in the resources directory that you wouldn’t upload to a website, like a Photoshop PSD. Or, anything else will do.
  • Download a file from a website you’re going to edit, like contact.php, into the backup directory.
  • Double-click zzz01_bckup_to_wking.bat to copy contact.php from the backup directory to the aaa-working directory.
  • Open contact.php in the aaa-working directory, edit it, save it and close it.
  • Click the zzz02_wking_to_www.bat file to copy contact.php from the aaa-working directory to the www directory.
  • Zip the backup, resources, and www directories. You will now see the new zipped files below inside your updates directory:
    ---updates
    ------aaa-working
    ------backup
    ------resources
    ------www
    ------backup.zip
    ------resources.zip
    ------www.zip
    ------zzz01_bckup_to_wking.bat
    ------zzz01_wking_to_www.bat
    ------zzzz_____spacer03.bat
    ------zzzz_____spacer04.bat
    ------ZZZZZZ__DESTOYER.bat
  • Upload contact.php which has been edited from your www directory to the live website to make the changes live.
  • Upload the aaa-working.zipresources.zip and www.zip zipped files into your remote backup server.
  • Double-click the ZZZZZZ__DESTOYER.bat file to delete all the ZIP files and directories and then recreate the directories. These files should go to your recycle bin and you can start a new edit.
  • I created the zzzz_____spacer03.bat and zzzz_____spacer04.bat files to prevent you from accidentally moving your mouse too far below the zzz02_wking_to_www.bat file and clicking on the ZZZZZZ__DESTOYER.bat file which would delete all your work! Clicking the spacer files do nothing.

Leave a Reply

To Top ↑