Create Two folder with below names
One Space
Multiple Space
Execute below commands:-
cd \
set "d=One Space"
for /F "usebackq delims=#" %F in (`powershell -command "& {Get-ChildItem \"%d%\"}"`) do (echo %F)
set "e=Multiple Space"
for /F "usebackq delims=#" %F in (`powershell -command "& {Get-ChildItem \"%e%\"}"`) do (echo %F)
Can someone explain or provide solution for executing command whose path have multiple spaces?
I think you can just use single quotes to keep the multiple spaces:
cd \
set "d=One Space"
for /F "usebackq delims=#" %F in (`powershell -command "& {Get-ChildItem \'%d%\'}"`) do (echo %F)
set "e=Multiple Space"
for /F "usebackq delims=#" %F in (`powershell -command "& {Get-ChildItem \'%e%\'}"`) do (echo %F)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.