I seem to recall that you can set up a powershell script to accept a command
line parameter that would allow you to skip to a certain location in the
script, but i can't for the life of me recall what it was. It seemed to be
related to $Status.
I seem to recall that you can set up a powershell script to accept a command
line parameter that would allow you to skip to a certain location in the
script, but i can't for the life of me recall what it was. It seemed to be
related to $Status.
Hi GreatBarrier,
I'm not 100% certain what you're asking, but this may help:
param( [string] $switch = "Red")
switch -regex ($switch){
"red" {write-host "Red"}
"blue" {write-host "Blue"}
Default {write-host "Green"}
}
Examples:
PS C:\Toolbox\Scripts> test-switch Red
Red
PS C:\Toolbox\Scripts> test-switch green
Green
PS C:\Toolbox\Scripts> test-switch white
Green
PS C:\Toolbox\Scripts> test-switch blue
Blue
PS C:\Toolbox\Scripts> test-switch
Red
"greatbarrier86" <greatbarrier86@xxxxxx> wrote in message
news:4B540671-81EE-403F-B5BD-EBCDFEB67DFB@xxxxxx
> I seem to recall that you can set up a powershell script to accept a
> command
> line parameter that would allow you to skip to a certain location in the
> script, but i can't for the life of me recall what it was. It seemed to be
> related to $Status.
"greatbarrier86" <greatbarrier86@xxxxxx> wrote in message
news:609A8F99-BDDC-42F6-BFDE-F1B895DA5595@xxxxxxThere is no "goto" statement in PowerShell however you should be able to do
> I dont think that's it. What i mean is that i'd like to be able to
> execute
> my script, reboot, and start where it left off, requring a switch that
> would
> tell it to go to a certain section. Does that make sense?
something like this:
param([switch]$AfterReboot)
if (!$AfterReboot) {
do stuff
do more stuff
put a call to this script with -AfterReboot parameter in the RunOnce reg
key
invoke reboot
}
else {
do post reboot stuff here.
}
--
Keith
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can i start Explorer in specific location ? | Lucske | Vista performance & maintenance | 1 | 24 Oct 2008 |
| cannot publish the movie to the specific location | Spoon | Vista music pictures video | 0 | 18 Jun 2008 |
| Using EXE Switches in Powershell | greatbarrier86 | PowerShell | 6 | 10 Jan 2008 |
| Can one put offline files at a specific location? | Michael Moser | Vista file management | 0 | 06 Dec 2007 |
| Saving to a specific location | Johnnyboy | Vista file management | 1 | 13 Jul 2007 |