Skip to content

SpaghettDev/powershell-foreach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

powershell-foreach

a simple foreach command in powershell because why not

loops over the 1st parameter (a file or a path to one), then executes the 2nd parameter if it matches the 3rd parameter (by default ".*")

Examples:

Example 1: No 3rd parameter
  • shell:
./foreach ./test.txt explorer
  • test.txt:
C:\Program Files
C:\Program Files (x86)
  • What is does: Opens 2 Windows Explorer windows, the first being "C:\Program Files", the second being "C:\Program Files (x86)".
Example 2: With 3rd parameter
  • shell:
./foreach ./test.txt explorer "D:"
  • test.txt:
C:\Program Files
C:\Program Files (x86)
D:\Projects
X:\ye
  • What is does: Opens 1 Windows Explorer window, that being "D:\Projects" since it's the only line that matches "D:".

License:

This project is under "The Unlicense" found here.

About

a simple foreach command in powershell because why not

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published