Running Powershell to automate tasks.
Posted on 2013-01-11
I'm new to powershell and would like a powershell script to do jobs for me.
I have several things to do in Windows 7. Several of which is to unzip folders, copy files and click on some exe files to run. I've done this manually and would like to automate this. Running a script to automate these manual tasks will help a lot.
Ok heres some background information:
There is a root folder, lets call it RootFolder that has 2 folders. Lets call it foo1 and foo2. These 2 folders contain a number of files.
There is also two zipped folders that contain a number of folders and files. Lets called these zipped folders, foo1.zip and foo2.zip. When the zipped folders are unzipped they contain a similar structure as the above folders.
e.g foo1.zip unzips to C:\foo1\foo1\f1.txt, C:\foo1\foo1\f1.exe, and other folders and files which I'm not interested in. Like wise foo2.zip unzips to simillar file structures.
What I'd like powershell to do is:
1. unzip foo1.zip
2. copy and replace the file C:\foo1\foo1\f1.txt with C:\RootFolder\foo1\f1.txt
3. unzip foo2.zip
4. copy and replace the two files C:\foo2\foo2\f21.txt and C:\foo2\foo2\f22.txt with C:\RootFolder\foo2\f21.txt and C:\RootFolder\foo2\f22.txt
Output a message to say that it finished 1,2,3,4.
5. Run the exe file f1.exe in C:\foo1\foo1\. Let it run for 5 mins.
6. Run the exe file f2.exe in C:\foo2\foo2\. Let it run for 5 mins.
7. Output a message to show that it finished.
Thanks in advance for your help.