Score:0

Globing patterns

jp flag

How can I make a command string work using globing patterns also in the given arguments?

powershell.exe -c "&'c:\wind?ws\System32\more.com' C:\path\to\something.txt | findstr 'something'" -> this works

This is what I would like to do, for example:

powershell.exe -c "&'c:\wind?ws\System32\more.com' C:\wind?ws\w?n.ini | findstr 'something'"

I tried using another &, but seems like is gets interpreted in the wrong way

Score:0
th flag

In cmd, you can use global wildcards like * and ? in the last element of a path only.

Here are (some) equivalent alternatives:

  • if you insist upon more.com and findstr.exe:
powershell.exe -nopro -c "& 'c:\wind?ws\Syst?m32\mor?.com' (Resolve-Path C:\wind?ws\w?n.ini) | findstr 'fil ext app'"
; for 16-bit app support
[extensions]
[mci extensions]
[files]
  • use native PowerShell instruments:
powershell.exe -nopro -c "(Get-Content C:\wind?ws\w?n.ini) -match 'fil|ext|app'"
; for 16-bit app support
[extensions]
[mci extensions]
[files]
jp flag
Thanks!!!! You made me happy!!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.