JAVA创建桌面快捷方式

@RequestMapping(value = "/desktop_icons")
    public void desktopIcons(ModelMap model, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        String templateContent = "[InternetShortcut]" + "\r\n" + "URL= http://www.xxxx.com" + "\r\n" + "IconIndex=1" + "\r\n" + "IconFile=http://www.xxxx.com/favicon.ico\r\n";       
        PrintWriter outa =response.getWriter();
        String file = java.net.URLEncoder.encode("百度.url","UTF-8"); 
        response.addHeader("Content-Disposition","attachment;filename="+file);
        StringBuffer bf=new StringBuffer();  
        bf.append(templateContent);    
        bf.append("IDList=\r\n");
        bf.append("[{000214A0-0000-0000-C000-000000000046}]\r\n");
        bf.append("Prop3=19,2\r\n");
        outa.write(bf.toString());  
        outa.flush();  
        outa.close(); 
    }

你可能感兴趣的:(Java)