首页 > 解决方案 > Powershell:将函数添加到没有变量的命令行中

问题描述

在 powershell 中是否有可能跳过变量并将 driveletter 函数直接包含在执行命令的路径中?

. (Get-Volume -FileSystemLabel myHDD).DriveLetter:\temp\ps.ps1

该命令应如下所示:

. D:\temp\ps.ps1

当我在 powershell 中运行它时,我收到此错误:

. : The term 'D' 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.

在行:1 字符:3

谢谢你的帮助!

标签: powershell

解决方案


推荐阅读