Reputation: 583
For example, cd (echo ..)
works in powershell, but how do I get it working in batch (it evaluates the echo first, and so the command is effectively cd ..
)? mycommand.exe (ls -fi *.hs -exclude \"#*\" -name -r)
is what I'm actually trying to convert (it sends a, completed, filtered file listing to mycommand
).
Upvotes: 0
Views: 72
Reputation: 129566
add the $
symbol to evaluate the commands in the parens first:
mycommand.exe $(ls -fi *.hs -exclude \"#*\" -name -r)
or
ls -fi *.hs -exclude \"#*\" -name -r | mycommand.exe
If you want to execute the command for each item returned from your ls, you can:
ls -fi *.hs -exclude \"#*\" -name -r | %{mycommand.exe $_ }
Upvotes: 0
Reputation: 354506
setlocal enabledelayedexpansion
set LIST=
for /r %%F in (*.hs) do (
set "FN=%%F"
if not "!FN:~0,1!"=="#" set LIST=!LIST! "%%F"
)
mycommand.exe !LIST!
would be a rough translation.
Upvotes: 1