I wrote it as I am very into making my software portable, so I can take my software with me.
I haven't tested it with Windows 8, I used to do the process manually by changing the icon of the folder (Right Clicking > Properties > Customize > Change Icon, this was created to save time.
Example Folder Icons

When I create the portable software I like to have the icons & folders looking nice, I also like it to follow the folder. Windows can be funny and it may work instantly, other times there is a delay, even a reboot has been required at times. Not sure why that is.
Working Script Example

Code: Select all
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1
ExtractFileName>Command_Line,strFileName
ExtractFileExt>Command_Line,strExt
StringReplace>%strFileName%,",,strFileName
StringReplace>%strExt%,",,strExt
StringReplace>%strFileName%,%strExt%,,strFileName
Trim>%strFileName%,strFileName
Let>APP_TITLE=%strFileName%
Label>Start
Let>INPUT_BROWSE=1
Input>ExecutableName,Please Select The Executable / Icon File In The Folder%CRLF%You Would Like To Change The Folder Icon For...,
If>ExecutableName=
MDL>Please select a exe or ico file...
Goto>Start
Else
ExtractFileName>%ExecutableName%,strFileName
StringReplace>%ExecutableName%,%strFileName%,,strFilePath
Goto>CreateDesktopINI
EndIf
Label>CreateDesktopINI
DeleteFile>%strFilePath%desktop.ini
WriteLn>%strFilePath%desktop.ini,,[.ShellClassInfo]
WriteLn>%strFilePath%desktop.ini,,IconResource=%strFileName%,0
WriteLn>%strFilePath%desktop.ini,,IconFile=%strFileName%
WriteLn>%strFilePath%desktop.ini,,IconIndex=0
Label>SetAttrib
//Sets Attrib To Display Icon
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Let>Pattern=\\$
RegEx>Pattern,strFilePath,0,matches,num,1,,strFilePath
Run>cmd /c attrib +a +s +h "%strFilePath%\desktop.ini"
Wait>0.1
Run>cmd /c attrib +r "%strFilePath%"
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1
MessageModal>Created "desktop.ini" File%CRLF% %strFilePath%\desktop.ini%CRLF%%CRLF%Custom Folder Icon Set For The Below Folder%CRLF% %strFilePath%%CRLF%%CRLF%Written By Michael Allen © 2013%CRLF%[email protected]%CRLF%Mobile: 0413 392 169%CRLF%%CRLF%MJTECH MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. MJTECH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL MJTECH BE LIABLE TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. MJTECH WILL NOT PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
Label>End