Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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
String 如何将变量放入变量-批处理_String_Variables_Batch File_Replace_Find - Fatal编程技术网

String 如何将变量放入变量-批处理

String 如何将变量放入变量-批处理,string,variables,batch-file,replace,find,String,Variables,Batch File,Replace,Find,我想知道如何用另外两个变量设置一个变量 我的代码: @echo off set str=the cat and the mouse and the car and the bull and the joker and the batman and some random guy echo.%str% set /p find= set /p replace= set str=%str:%find%=%replace%% echo.%str% pause 尝试: 尝试: 非常感谢。这正是我想要

我想知道如何用另外两个变量设置一个变量

我的代码:

@echo off

set str=the cat and the mouse and the car and the bull and the joker and the batman and some random guy

echo.%str%
set /p find=
set /p replace=
set str=%str:%find%=%replace%%
echo.%str%
pause
尝试:

尝试:


非常感谢。这正是我想要的谢谢你。这正是我想要的
@echo off
setlocal enableDelayedExpansion
set str=the cat and the mouse and the car and the bull and the joker and the batman and some random guy

echo.%str%
set /p find=
set /p replace=
set str=!str:%find%=%replace%!
echo.%str%
pause