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.zipdirectory that contains files you’ll need here and move it to your
- After unzipping the
updates.zipdirectory 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
Edit with Notepad++from the menu that appears so you can edit the file.
usernamewith your Windows username. If you’re on a work computer and your name is Jane Doe it’ll be something like
- Follow the same process to change the username text in all the other
.batfiles EXCEPT for
- Put a file in the
resourcesdirectory 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
backupdirectory to the
aaa-workingdirectory, edit it, save it and close it.
- Click the
zzz02_wking_to_www.batfile to copy
aaa-workingdirectory to the
- Zip the
wwwdirectories. You will now see the new zipped files below inside your
---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
contact.phpwhich has been edited from your
wwwdirectory to the live website to make the changes live.
- Upload the
www.zipzipped files into your remote backup server.
- Double-click the
ZZZZZZ__DESTOYER.batfile 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_____spacer04.batfiles to prevent you from accidentally moving your mouse too far below the
zzz02_wking_to_www.batfile and clicking on the
ZZZZZZ__DESTOYER.batfile which would delete all your work! Clicking the
spacerfiles do nothing.