Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file Wget-P在Windows下的用法,路径包含一些空格字符_Batch File_Path_Wget - Fatal编程技术网

Batch file Wget-P在Windows下的用法,路径包含一些空格字符

Batch file Wget-P在Windows下的用法,路径包含一些空格字符,batch-file,path,wget,Batch File,Path,Wget,我尝试使用wget和-p选项来指定下载文件的输出路径。但是当路径中有一些空间时,我会遇到一些问题。 我试过几种方法来解决这个问题,但都没有成功 这些例子不起作用: wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P="\\NAS\folder with space" wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P='\\NAS\folder with

我尝试使用wget和-p选项来指定下载文件的输出路径。但是当路径中有一些空间时,我会遇到一些问题。 我试过几种方法来解决这个问题,但都没有成功

这些例子不起作用:

wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P="\\NAS\folder with space"

wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P='\\NAS\folder with space'

wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P=\\NAS\folder\ with\ space

wget -N --tries=3 --timeout=5 --random-wait "https://xxx" -P=\\NAS\folder%20with%20space
PS:这些示例是从windows批处理文件执行的

引用自
wget--help

 Directories:
  -nd, --no-directories           don't create directories.
  -x,  --force-directories        force creation of directories.
  -nH, --no-host-directories      don't create host directories.
       --protocol-directories     use protocol name in directories.
  -P,  --directory-prefix=PREFIX  save files to PREFIX/...
       --cut-dirs=NUMBER          ignore NUMBER remote directory components.
我的理解是,单字母(单破折号)选项不需要值中的分隔符,
而不同长度的冗长的需要等号


(所有单破折号、双字母选项都是不带值的开关)

尝试使用
-p“\\NAS\folder with space”
我测试了@LotPings语法,这是正确的。我还测试了将整个路径放在-O选项中,这同样有效。但我相信这只是一个文件。您的另一个选择是在
WGET
命令之前和之后使用
PUSHD
POPD
。感谢@Squashman提供的提示。POPD/PUSHD非常有用,允许我直接从Windows计算机执行存储在NAS中的bach文件。因此,通过使用
pushd%~dp0
我可以在批处理文件所在的目录中启动下载过程。那太棒了!!!很清楚!也许,我得换眼镜了!谢谢。