Powershell选择菜单 [英] Powershell select menu

查看:227
本文介绍了Powershell选择菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我有一个文本文件,其中包含以下所有旧机器的信息

I have a text file with all the Older machine's information as below

机器名称       RAM     HD    操作系统

machine name      RAM     HD     OS

----------------        -------    ----     -------

----------------        -------    ----     -------

win7                      4GB     40GB   Windows 7

win7                     4gb     40GB   windows 7

windows2            8GB     120GB   Windows 2012 R2

windows2            8gb     120gb   windows 2012 R2

..

...

Windows2016     16GB    120GB    Windows 2016

Windows2016     16gb    120gb    Windows 2016

我正在寻找的是,使用现有信息创建一个选择菜单,如

what I am looking for is, use the existing information to create a select menu like

菜单

====



$
1. win7      ;                4GB     40GB   windows 7&


2. windows2            8GB     120GB   windows 2012 R2



3. ... ...
$
4.  ... ...


18. Windows2016     16GB    120GB    Windows 2016



$
选择数字[1..18]从域中删除机器:





然后我输入"1"删除win7,"2"删除windows2 ....."18"从域中删除windows2016



我确实使用get-content来获取现有的文件信息,并准备好从域中删除机器的代码。



关键是如何将它们连接在一起以制作选择菜单(如旧DOS时间)



谢谢和最诚挚的问候,$
Powershell中的NewBie

Menu
====


1. win7                     4gb     40GB   windows 7

2. windows2            8gb     120gb   windows 2012 R2

3. ...

4.  ...

18. Windows2016     16gb    120gb    Windows 2016


Select the number[1..18] to remove the machine from domain:


then I just type "1" to remove win7, "2" to remove windows2..... "18" to remove windows2016 from domain

I did use get-content to get the existing file information, and have code ready for remove the machine from domain.

the point is how to link them together to make a select menu (like old DOS time)

Thanks and Best Regards,
NewBie in Powershell

推荐答案

显示您的代码!


这篇关于Powershell选择菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆