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 如何在批量URL中定义变量?_Batch File_Variables_Url - Fatal编程技术网

Batch file 如何在批量URL中定义变量?

Batch file 如何在批量URL中定义变量?,batch-file,variables,url,Batch File,Variables,Url,我试图定义变量%anzahl%,并使用它发出以下curl请求。但该变量在URL中无法识别 @echo off Setlocal EnableDelayedExpansion set /p anzahl=0952-8873 curl https://thekeepers.org/journals?query=%anzahl% >>thekeepers.xml pause 开关/p用于用户输入。它后面的内容是显示为提示输入内容的文本 所以你应该选择

我试图定义变量%anzahl%,并使用它发出以下curl请求。但该变量在URL中无法识别

 @echo off
    Setlocal EnableDelayedExpansion 

    set /p anzahl=0952-8873
    curl https://thekeepers.org/journals?query=%anzahl% >>thekeepers.xml
    pause
开关/p用于用户输入。它后面的内容是显示为提示输入内容的文本

所以你应该选择:

@echo off
Setlocal EnableDelayedExpansion 
set anzahl=0952-8873
curl https://thekeepers.org/journals?query=%anzahl% >>thekeepers.xml
pause

您是否尝试将0952-8873分配给变量名anzahl?如果是,请删除/P选项。这需要用户输入。