powershell - 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
- . (Get-Volume -FileSystemLabel myHDD).DriveLetter:\temp ...
-
+ CategoryInfo : ObjectNotFound: (D:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
谢谢你的帮助!
解决方案
推荐阅读
- java - accountlist需要以表格形式显示在jsp上
- algorithm - 递归关系的时间复杂度 T(n) = T(n-1)*n
- java - 为什么 VNC 服务器不提供多屏功能?
- vba - 通过 VBA 将文件上传到 SharePoint
- sql-server - 使用 SQL 身份验证的 SQL Server 2016 使用 powershell 在 MSDB 中部署 SSIS 包
- javascript - 替换字符串中的所有字符,但数组中存在的字符除外
- c# - 等待手动创建的任务不考虑内部等待
- python - Matplotlib 一次显示一个图
- html - 使整个 DIV 成为 Angular 7 中的链接
- python - 通过 Python/Requests 登录华尔街日报