简体   繁体   中英

Include text from a file into a powershell command

I need your help

Set-ClientAccessServer -AutoDiscoverSiteScope Location1,Location2,etc.....

I'll use a txt file where I add locations and need help to tweak the command so I only need to write:

Set-ClientAccessServer -AutoDiscoverSiteScope | Get-Content -path C:\txtfile

Hope you know what i mean BR

In PowerShell, to incorporate the returned objects of one command as parameters to a second, enclose the first command in parentheses () . Assuming that you are passing these locations to the -AutoDiscoverSiteScope parameter, your command would be

Set-ClientAccessServer -AutoDiscoverSiteScope (Get-Content -Path C:\TxtFile)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM