[英]passing CMD arguments to Powershell
Here the Code:这里的代码:
@echo off
if "%*"=="" (echo Give me the URL! && exit /b)
echo Output :
set /p output=
powershell Invoke-WebRequest -Uri %* -OutFile output
The problem in this code I've written is output variable我写的这段代码中的问题是output变量
how to send that variable into powershell?如何将该变量发送到 powershell?
Use %output%
to expand the output
variable - and remember to quote the arguments (otherwise it'll break if someone inputs a path with spaces):使用%output%
扩展output
变量 - 并记住引用 arguments (否则,如果有人输入带有空格的路径,它将中断):
@echo off
if "%*"=="" (echo Give me the URL! && exit /b)
echo Output :
set /p output=
powershell Invoke-WebRequest -Uri '%*' -OutFile '%output%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.