現在、ユーザー名のリストを読み取り、それをエコーする次の ps があります。
ユーザー名ファイルは次のとおりです
username1
username2
username3
psスクリプトは次のとおりです
$userNames = (Get-Content usernames.txt)# | Sort-Object
$userID=0
$userNames.Count
echo "FROM table WHERE (userID ='"
For ($i =1; $i -le ($userNames.Count - 1); $i++)
{
echo $userNames[$userID] "' OR userID='"
$userID++
}
echo $userNames[$userNames.Count - 1] "'"
これをすべて同じ行でエコーする(そして最終的にテキストファイルに書き込む)ことを望んでいます。
FROM table WHERE (userID = 'username1' OR userID = 'username2' OR userID = 'username3'
これを解決するにはどうすればよいですか?