In my last post, I mentioned that I was going to write up some of the
utility scripts I have on my VM. The first one is pretty simple. It's a
little PowerShell script to zip up the My Documents folder on the VM,
and copy it to the physical machine. (I'm using 7-Zip.)
There are a few things in this script that are
pretty common tasks that I need to do when using PowerShell, so this is a
good thing to put up on the blog for reference. Just to point out those
things:
Creating a file name that contains the current date.
Running a command that's in a string variable.
Prompting to "press any key" when done, so the user can see error messages, if the script is being run from a desktop icon.
Giving an option to skip the "press any key" prompt, when the command is run unattended from task scheduler.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters