Note that there are some explanatory texts on larger screens.

plurals
  1. POJava - Getting the path to all users in windows
    primarykey
    data
    text
    <p>I am working on writing into the shortcut directory of all users, and I have it working I believe but the way I am getting the paths don't seem right. And I don't know if it is the correct way of checking if the all users path is there or if there is a better way. This is suppose to be able to work on windows xp - windows 8. and from windows server 2000 - 2012. Here is the code:</p> <pre><code> int pathOne = 0; int pathTwo = 0; String allUserPath = ""; File sourceOne = new File("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\"); if (sourceOne.exists()) { pathOne = 1; } File sourceTwo = new File("C:\\Documents and Settings\\All Users\\Start Menu\\"); if (sourceTwo.exists()) { pathTwo = 1; } if (pathOne == 1 &amp;&amp; pathTwo == 0) { allUserPath = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs"; } if (pathTwo == 1 &amp;&amp; pathOne== 0) { allUserPath = "C:\\Documents and Settings\\All Users\\Start Menu\\Programs"; } </code></pre> <p>Update: Doing some research I found out that you can execute command line querys. </p> <pre><code> public static final String REG_QRY_CMD="reg query "; public static final String SHORT_CUT_REG_KEY="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"; String str = REG_QRY_CMD+"\""+ SHORT_CUT_REG_KEY+"\""+ " /v " + "\""+ "Programs" +"\""; </code></pre> <p>Now this will get me up to the current user's program folder: Example "C:\Documents and Settings\al\Start Menu\Programs" or "E:\Documents and Settings\meg\Start Menu\Programs" Is there a way I can slice this? to atleast get the "?:\Documents and Settings\"? That way I can atleast add it into all users instead of just the current user. This way it will be less guess work and slightly better. Thank you </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload