我将环境变量artemis_home
设置为C:\artemis
。
PS C:\artemis_brokers> $env:ARTEMIS_HOME C:\artemis
在这个目录下,我有一个名为bin的文件夹,它包含一个artemis.cmd
脚本。如何使用system变量从PowerShell中的任何地方运行此脚本?
我尝试过以下方法,但没有成功:
PS C:\artemis_brokers> $env:ARTEMIS_HOME/bin/artemis At line:1 char:19 + $env:ARTEMIS_HOME/bin/artemis + ~ You must provide a value expression following the '/' operator. At line:1 char:19 + $env:ARTEMIS_HOME/bin/artemis + ~~~~~~~~~~~ Unexpected token 'bin/artemis' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : ExpectedValueExpression
PS C:\artemis_brokers> ./$env:ARTEMIS_HOME/bin/artemis ./$env:ARTEMIS_HOME/bin/artemis : The term './$env:ARTEMIS_HOME/bin/artemis' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ./$env:ARTEMIS_HOME/bin/artemis + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (./$env:ARTEMIS_HOME/bin/artemis:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\artemis_brokers> ./$env:ARTEMIS_HOME/bin/artemis.cmd ./$env:ARTEMIS_HOME/bin/artemis.cmd : The term './$env:ARTEMIS_HOME/bin/ artemis.cmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ./$env:ARTEMIS_HOME/bin/artemis.cmd + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (./$env:ARTEMIS_HOME/bin/artemis.cmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\artemis_brokers> ./"$env:ARTEMIS_HOME/bin/artemis.cmd" ./$env:ARTEMIS_HOME/bin/artemis.cmd : The term './$env:ARTEMIS_HOME/bin/ artemis.cmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ./"$env:ARTEMIS_HOME/bin/artemis.cmd" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (./$env:ARTEMIS_HOME/bin/artemis.cmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\artemis_brokers> .\$env:ARTEMIS_HOME/bin/artemis .\$env:ARTEMIS_HOME/bin/artemis : The term '.\$env:ARTEMIS_HOME/bin/artemis' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + .\$env:ARTEMIS_HOME/bin/artemis + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (.\$env:ARTEMIS_HOME/bin/artemis:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\artemis_brokers> .\$env:ARTEMIS_HOME/bin/artemis.cmd .\$env:ARTEMIS_HOME/bin/artemis.cmd : The term '.\$env:ARTEMIS_HOME/bin/ artemis.cmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + .\$env:ARTEMIS_HOME/bin/artemis.cmd + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (.\$env:ARTEMIS_HOME/bin/artemis.cmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\artemis_brokers> .\"$env:ARTEMIS_HOME/bin/artemis.cmd" .\$env:ARTEMIS_HOME/bin/artemis.cmd : The term '.\$env:ARTEMIS_HOME/bin/ artemis.cmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + .\"$env:ARTEMIS_HOME/bin/artemis.cmd" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (.\$env:ARTEMIS_HOME/bin/artemis.cmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
在尝试执行之前,您需要展开该变量并将路径的其余部分串联成一个字符串。要执行结果字符串,请使用&
,即调用运算符:
& "$env:ARTEMIS_HOME/bin/artemis.cmd"
希望有人能帮忙——我的Jenkins实例中安装了以下插件——但我似乎无法掌握下面的Git变量。我需要这些来完成我们的CI设置。有什么我遗漏的吗? 我把它们传递给他们,就像: 嘘builder@10.10.10.10“/build-pass.sh$GIT_BRANCH” git插件设置了几个可以在脚本中使用的环境变量: > GIT_COMMIT-当前的SHA GIT_BRANCH-当前使用的分支的名
问题内容: 我正在尝试从Windows命令提示符(Windows 10)运行python。因此,结果是未配置路径环境变量时的典型结果 但是,我不确定应该在path变量中设置哪个目录。 我尝试了一些变体,但没有一个起作用,包括: 他们都不起作用。 有没有人对这个特定的系统星座(Windows,anaconda)有经验。谢谢。 问题答案: 原来我错了。 解决方案是:在anaconda(以及其他实现中)
问题内容: 是否可以在.sql文件中使用Linux环境变量?我正在使用复制/选择查询来写入输出文件,并且我想将该目录放入变量中。所以我想做这样的事情: Outputdir将在我的环境中设置。这可能吗? 问题答案: 您可以将shell命令的结果存储在这样的变量中: 您的案例的一个例子是: 请注意,在示例中,您需要在脚本文件中设置变量,但是如果在调用时设置了第一行,则可以跳过第一行:
我正在使用多根工作区功能查看我的c项目中的源文件以及几个外部库。我正在尝试使用cpptools扩展来实现intellisense和其他功能。我想在工作区级别相对于。code-workspace文件设置默认包含路径。使用${workspaceFolder}解析为包含所查看文件的文件夹的路径。是否存在始终解析代码工作区文件路径的环境变量?还是我可以设置一个配置变量,然后使用${config:varia
问题内容: 需要基于构建环境配置来设置标签的href值。 例如: 分期应有 产品应具有 当前设置: 生成命令: .env.staging.js: index.html: 在index.html中,这似乎不起作用。虽然类似的设置适用于JS文件 (可能是因为将JS文件解析并捆绑到一个文件中,并且捆绑程序在该时间点读取值) 尝试过的事情: index.html: (类似于PUBLIC_URL变量) 与浏
问题内容: 我正在尝试从我的Perl程序中运行Bash命令。但是Perl似乎使我的Bash $ PWD环境变量与Perl变量混淆了。 我如何才能将其全部读取为字符串? 这就是我要运行的 这些反引号在Bash中运行第二行。使用System()会产生相同的问题。 有任何想法吗? 问题答案: 这里有两个查询,关于使用Bash变量和运行外部命令。 Perl中有哈希,带有环境变量 但是,通常最好在脚本中使用