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.
有人可以向我解释为什么这不起作用。
FOR %%G IN (C:\) do echo %~nG
根据文件.. %~nG 应该得到文件名
如果它在批处理文件中,则需要%%~nG.
%%~nG
如果它是直接从提示符执行的,你需要FOR %G ...
FOR %G ...
无论哪种方式,您都需要添加文件掩码c:\*
c:\*