Learn about Windows PowerShell
Summary: Beginner Event 3 of the 2012 Scripting Games requires you to create a file in a folder that may or may not exist.
About this event
Date of Event
4/4/2012 12:01 AM
4/11/2012 12:01 AM
You are a local user, and you want to document the processes that are running on your computer. You decide that you would like to list the name and process ID of each process running on your computer. You want to save this information in a nested folder. Because you use a number of different computers, you are never certain that the folder will exist. The folder is nested off the root directory in the following location:
The following image illustrates the folder/file arrangement.
The image that follows illustrates the contents of the Process3.txt file.
2012 Scripting Games: All Links on One Page
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy
From the way this is worded, it can be assumed that the file does not exist therefor we do not need to check for it?
@Kyle the event specifically talks about checking for the folder, but does not specifically mention the file. If the file exists, you can either overwrite it or append to it ... that is a design point for you to make.
I wonder if I am missing something here. I do not see the need for any command line arguments. As the scenario reads, there is no choice that is required to be made. If we have access to C:\ then we MUST create a file named Process3.txt in the subfolder 2012SG\event3. Where is the value of command line arguments here ?
@Ratty67 You are right. The scenario does not REQUIRE command line arguments, but one might be added, for example you might want to include a parameter that allows you to select where to store the output file. Or to type in a custom name for the file. This would permit using the code somewhere else for some other purpose.
excuse me, I have a question. I submit wrong script in advan event 3, it should be submit in beginner event 3. and i have been submitted it in beginner event 3 channel. but could i submit the other verison script in advan event 3 again?
Accidently submitted it to Advanced 3. Sorry :(
Please email to scripter@Microsoft.com and give him the full URL of the exact submission that is wrong... for example this is the URL for my event one. 2012sg.poshcode.org/2005
Ed will then check with Joel about changing the category.
@Everyone. Please double check your category and event this is a manual process for Joel to correct the submission and can only be done if he is not overwhelmed with them.