3 Replies Latest reply: Mar 19, 2013 11:49 AM by gimbal2 RSS

    placing image icon on top of batch file

    mjmjava
      i am creating a batch file , now i want to place application specific icon on top of that file , so how can i do it through my code

      File batchFile = new File(installationDirectory+ "\\"+ "QTL.bat");
      fos = new FileOutputStream(batchFile);
      DataOutputStream dos=new DataOutputStream(fos);
      dos.writeBytes("set JAVA_HOME="+ "\""+ javaHome+ "\"" +"\n");
      dos.writeBytes("set QTL_HOME="+ installationDirectory+ "\n");
      dos.writeBytes("cd %QTL_HOME%"+ "\n");


      Regards
        • 1. Re: placing image icon on top of batch file
          gimbal2
          Forget Java, try to do it using Windows itself. Can you? Because I certainly can't.
          • 2. Re: placing image icon on top of batch file
            rp0428
            >
            i am creating a batch file , now i want to place application specific icon on top of that file , so how can i do it through my code
            >
            You can't - a batch file doesn't have an Icon or a place to store one.

            On Windows you can specify the icon for a shortcut.

            1. create a shortcut on the desktop to the batch file
            2. right-click the shortcut and select 'Change Icon
            3. select your icon from the available list or point to another DLL that has the icon you want to use.

            The only way to do the above programatically is to use the Win API to programatically create the shortcut and do it.
            • 3. Re: placing image icon on top of batch file
              gimbal2
              rp0428 wrote:
              The only way to do the above programatically is to use the Win API to programatically create the shortcut and do it.
              Perhaps invoking some command line utility through runtime.exec() can also do the job (I don't know any such program though). But in any case you don't do it using plain old Java as it is very Windows specific.