Вопрос

What I tried to do is put dir in "Answer" variable. The variable's result have nothing inside it. What did I do wrong?

@echo off
set /p name=Program name:
echo %name%
set Answer=dir /s /a /b C:\%name%
echo %Answer%
Pause
Это было полезно?

Решение

You can put a command line into a variable, but a variable is not intended to hold a page of data.

If you had used this by itself (instead of echo %answer%)then it would display the dir output:

%answer% 
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top