Echo variables with space
Posted: 25 Jun 2024 09:03
Hi, I'm trying to create a script to remove desktop shortcuts via GPO, I have the following code:
@echo off
set "shortcut=Adobe Acrobat.lnk Firefox.lnk Google Chrome.lnk Google Earth Pro.lnk"
for /d %%a in (%shortcut%) do (
echo %%a
)
Which is returning to me as follows:
Adobe
Acrobat.lnk
Firefox.lnk
Google
Chrome.lnk
Google
Earth
Pro.lnk
When in fact I needed it to come back to me as follows:
Adobe Acrobat.lnk
Firefox.lnk
Google Chrome.lnk
Google Earth Pro.lnk
The problem is that I can't print the full name that contains spaces, does anyone know how I could do this?
@echo off
set "shortcut=Adobe Acrobat.lnk Firefox.lnk Google Chrome.lnk Google Earth Pro.lnk"
for /d %%a in (%shortcut%) do (
echo %%a
)
Which is returning to me as follows:
Adobe
Acrobat.lnk
Firefox.lnk
Chrome.lnk
Earth
Pro.lnk
When in fact I needed it to come back to me as follows:
Adobe Acrobat.lnk
Firefox.lnk
Google Chrome.lnk
Google Earth Pro.lnk
The problem is that I can't print the full name that contains spaces, does anyone know how I could do this?