如何从history命令执行一个特定的命令?

时间:2016-09-23 15:09:39

标签: windows powershell

示例:

PS C:\Users\user01\Desktop\jogoForcaMVCSpring> history
    Id CommandLine
    -- -----------
    1 history
    2 ls
    3 cd ..
    4 cd .\jogoForcaMVCSpring
PS C:\Users\user01\Desktop\jogoForcaMVCSpring>

如何使用Id 2执行确切的命令?

也许像......

PS C:\Users\user01\Desktop\jogoForcaMVCSpring> execute history command -id 2

1 个答案:

答案 0 :(得分:1)

知道了:

invoke-history -id 2

在看到" get-help history"后,我注意到了一个"相关链接":invoke-history

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="linia">
  <a id="prev"></a>
  <div class="divs">
    <div class="bt"> <!-- only one div.bt for all the a.bt-o -->
      <a class="bt-o">2007</a>
      <a class="bt-o">2008</a>
      <a class="bt-o">2009</a>
      <a class="bt-o">2010</a>
      <a class="bt-o">2011</a>
      <a class="bt-o">2012</a>
      <a class="bt-o">2016</a>
      <a class="bt-o">2000</a>
      <a class="bt-o">2001</a>
    </div>
  </div>
  <a id="next"></a>
</div>
<div class="divs2">
  <div class="os"><div class="rok">2007</div>sample</div>
  <div class="os"><div class="rok">2008</div>sample</div>
  <div class="os"><div class="rok">2009</div>sample</div>
  <div class="os"><div class="rok">2010</div>sample</div>
  <div class="os"><div class="rok">2011</div>sample</div>
  <div class="os"><div class="rok">2012</div>sample</div>
  <div class="os"><div class="rok">2016</div>sample</div>
  <div class="os"><div class="rok">2000</div>sample</div>
  <div class="os"><div class="rok">2001</div>sample</div>
</div>