我想为有选择权的主脚本添加另一个(小)脚本。我怎么能这样做?
我要添加的脚本:
*$shell = New-Object -ComObject WScript.Shell
$desktop = [System.Environment]::GetFolderPath('Desktop')
$shortcut = $shell.CreateShortcut("$desktop\Jauns Notepad.lnk")
$shortcut.TargetPath = "notepad.exe"
$shortcut.IconLocation = "%windir%\system32\imageres.dll 98"
$shortcut.Save()*
主要剧本:
do {
do {
write-host ""
write-host "1 - Selection 1"
write-host "2 - Selection 2"
write-host ""
write-host "0 - Exit"
write-host ""
write-host -nonewline "Type your choice and press Enter: "
$choice = read-host
write-host ""
$ok = $choice -match '^[abcdx]+$'
if ( -not $ok) { write-host "Invalid selection" }
} until ( $ok )
switch -Regex ( $choice ) {
"1"
{
write-host "You entered '1'"
}
"2"
{
write-host "You entered '2'"
}
}
} until ( $choice -match "0" )
请有人帮忙!