简体   繁体   English

带有配置脚本的 PowerShell

[英]PowerShell with a configuration script

Needs some help.需要一些帮助。 We run PowerShell scripts using a configuration script.我们使用配置脚本运行 PowerShell 脚本。

eg .\\folderA\\TheConfigurationScript .\\scriptThatDoesAllTheWork.ps1例如 .\\folderA\\TheConfigurationScript .\\scriptThatDoesAllTheWork.ps1

The issue is that in the directory where scriptThatDoesAllTheWork.ps1 is located there are number of other scripts.问题是在 scriptThatDoesAllTheWork.ps1 所在的目录中还有许多其他脚本。

If I accidentally add a space before scriptThatDoesAllTheWork.ps1 all scripts located in that folder are executed如果我不小心在 scriptThatDoesAllTheWork.ps1 之前添加了一个空格,则会执行位于该文件夹中的所有脚本

eg .\\folderA\\TheConfigurationScript .\\ scriptThatDoesAllTheWork.ps1例如 .\\folderA\\TheConfigurationScript .\\ scriptThatDoesAllTheWork.ps1

All variables therefore defined in folderA\\TheConfigurationScript are available to scriptThatDoesAllTheWork.ps1 that does all the work因此,在文件夹A\\TheConfigurationScript 中定义的所有变量都可用于执行所有工作的scriptThatDoesAllTheWork.ps1

Is there any way to avoid this behaviour有什么办法可以避免这种行为

Thanks in advance提前致谢

Thanks to mclayton.感谢麦克莱顿。 I had a get-childitem that would return all the files in case of space.我有一个 get-childitem 可以在有空间的情况下返回所有文件。 In case this helps anyone如果这有助于任何人

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM