Reputation: 31
i want to change the icon of a nameless folder using the .bat file :
@echo off
set /p "fld=Folder: "
set /p "ico=Icon file: "
md "%fld%\icons" 2>nul
if exist %ico% copy "%ico%" "%fld%\icons\icon.ico" /y 1>nul
attrib -h -s "%fld%\desktop.ini" 2>nul
(
echo/[.ShellClassInfo]
echo/IconResource=icons\icon.ico,0
) > "%fld%\Desktop.ini"
attrib +h +s -a "%fld%\Desktop.ini"
attrib +r "%fld%"
attrib +h "%fld%\icons"
taskkill -im explorer.exe /f >nul&start explorer
pause
but i cannot refer to the nameless file that only contains a blank space (created by pressing Alt + 255 while renaming) ! when i use blank space instead of %fld% and run bat file! i want to change the .bat and remove %fld% with the reference to my nameless folder !
i get output :
The system cannot find the path specified.
Path not found - C:\Users\Sand\Desktop\if
The system cannot find the path specified.
Path not found - C:\Users\Sand\Desktop\if
Path not found - C:\Users\Sand\Desktop\if
Upvotes: 1
Views: 680
Reputation: 11
just alt+0255 can be passed in batch example
a="ÿ" echo "ÿ" set /p c="gg"
in here ÿ will be viewd as emptysace in batch when running ignore set /p c="gg" that just for making batch wait wait untill u press any value
Upvotes: 1
Reputation: 20189
Change this line:
set /p "fld=Folder: "
to
set "fld= "
The character after the =
that looks like a space is actually ALT+255
(press and hold ALT
and type 255 on the keypad.
Ah, it's been awhile since I've needed something like this.
You also have to change the code page.
Make the first line blank (this is necessary, because there are hidden chars in the first line for UTF-8 text file).
Put CHCP 65001
as second line.
Insert the rest of your batch code.
Save the BAT file as UTF-8.
Thanks to this answer for jogging my memory.
Upvotes: 2