在嵌套文件夹中调用Powershell脚本

时间:2019-02-04 16:42:27

标签: powershell batch-file

我有一个用于在公司中设置新计算机的批处理文件:

  • 激活本地管理员帐户并设置密码
  • 激活Windows
  • 调用PowerShell脚本重命名PC
  • 启动一个批处理文件,该文件将安装Office之类的基本程序。

但是,我想更改它,以便可以处理多个不同选项的批处理文件(将使用<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <title>Hello, world!</title> </head> <body style=" background-color: gray;" > <nav class="navbar navbar-custom Schatten navbar-expand-xl navbar-light justify-content-center"> <a class="navbar-brand" href="#"><img src="Brand1.png" style="height: 3.6rem; width: 108px;"></a> <a class="navbar-brand" href="#"><img src="Brand2.png" style="height: 3rem; width: 261px;"></a> <button class="navbar-toggler ml-1" type="button" data-toggle="collapse" data-target="#collapsingNavbar"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="collapsingNavbar"> <ul class="navbar-nav mr-auto navlinks-center"> <li class="nav-item active"> <a class="nav-link hvr-grow" href="#">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link hvr-grow" href="about.html">Über uns</a> </li> <li class="nav-item"> <a class="nav-link hvr-grow" href="events.html">Events</a> </li> <li class="nav-item"> <a class="nav-link hvr-grow" href="forum.html">Forum</a> </li> </div> </nav> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> </body> </html>命令完成)将使用适当的PowerShell脚本,这些脚本将移至同一文件夹中目录。

还要注意,这些将在USB驱动器上运行,因此驱动器号并不总是相同的(例如:set /p

批处理文件将保存在%flashdrive%\tools\PS_Scripts文件夹中,而脚本存储库将保存在Tools文件夹中。

如何将命令编辑为适当的语法以从嵌套文件夹中运行脚本?

PS_Scripts

0 个答案:

没有答案