-1

I want to use result of one command in the next command line. Is there any way to do it? preferably in one line. For e.g.

1st: where svn; 
2nd: explorer {{result_from_first_cmd}}.

I tried explorer where svn. Evidently didn't work.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

2 Answers2

0

Use a FOR loop. Yeah, it's crazy. It's Windows.

FOR /F "delims=" %%A IN ('where svn') DO (explorer "%%~A")
lit
  • 14,456
  • 10
  • 65
  • 119
-1

Which operating system are you using? Usually you can pipe outputs of one comman line tool to the next one using the | (pipe) operator.

  • using windows 10. I tried running commands with pipe but not expected output. Please help with the example I mentioned in question. powershell -command `where svn | explorer` is giving different result than running `where svn` and then `explorer {{copy_pasted_result_of_where_svn}}` – Abhilash Patel Sep 18 '19 at 20:10
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/24088750) – Nikolai Shevchenko Sep 19 '19 at 08:36
  • You can’t use a pipe to provide command-line arguments; a pipe connects an output stream (stdout and/or stderr) from one command to the stdin input stream of another. – Martijn Pieters Sep 19 '19 at 10:03
  • @NikolayShevchenko He didn't state his operating system. At this stage it was only possible to provide a general answer since there are a lot of possibilities. – Sascha Witte Sep 19 '19 at 11:49
  • @SaschaWitte Answers are for answers. No exceptions. Any clarifying questions should be put into the comments. Insufficient reputation is not an excuse. – Nikolai Shevchenko Sep 19 '19 at 12:25
  • @NikolayShevchenko So the solution is not helping? I think revealing the operating system sparked the discussion that lead to the correct answer. – Sascha Witte Sep 19 '19 at 12:34