Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图做的是将 dir 放入“Answer”变量中。变量的结果里面没有任何内容。我做错了什么?
@echo off set /p name=Program name: echo %name% set Answer=dir /s /a /b C:\%name% echo %Answer% Pause
您可以将命令行放入变量中,但变量并非旨在保存一页数据。
如果您自己使用了它(而不是echo %answer%),那么它将显示 dir 输出:
echo %answer%
%answer%