g-alex Posted August 18, 2005 Posted August 18, 2005 Hi, I want to know if there are variables for user's desktop, or start menu programs, because I'm using Both English and Greek versions of Windows XP, where these folder names are different.I also want to know if there is another way to make batch files for copying files in the desktop in both versions, or if I can check with a command the language of windows xp so i can go on with fixed paths.Thank you for any help
Doc Symbiosis Posted August 20, 2005 Posted August 20, 2005 I don't know, if this helps, but the paths to both are contained in the regkey HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders in the values "desktop" and "start menu".So in vbs or js you are able to put them in a variable. In a batch, I'm not quit sure, if you can put the value in a variable with the reg query command, but I'm trying to do this, just give me a little time.
glugolian Posted August 21, 2005 Posted August 21, 2005 I don't know, if this helps, but the paths to both are contained in the regkey HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders in the values "desktop" and "start menu".So in vbs or js you are able to put them in a variable. In a batch, I'm not quit sure, if you can put the value in a variable with the reg query command, but I'm trying to do this, just give me a little time.<{POST_SNAPBACK}>Maybe this help, I have something similar@ECHO OFF:: delims is tab folowed by spaceFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\id\Doom 3" /v InstallPath') DO SET InstallPath=%%BECHO InstallPath=%InstallPath%COPY .\CRACKOP.txt %InstallPath%PAUSESo I can find path in registry but rest of the command dont work. Can anyone correct that part of the command? Why file doesnt get copied in install folder of doom3 (this is just example, I put folder for doom3 because I have that key on my computer contains path to D:\Program files\Doom 3, something similar to problem that you have)I got Echo reply InstallPath=D:\Program Files\Doom 3 and now I want to copy file to that folder
g-alex Posted August 21, 2005 Author Posted August 21, 2005 Very interesting solution glugorian, I've tried your example and I can find the name of the folder "desktop" for using as a variable.So I've used this:@ECHO OFF:: delims is tab folowed by spaceFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Desktop') DO SET Desktop=%%BECHO Desktop=%Desktop%PAUSEBut the variable has the value "Settings\Alex\Desktop", I dont know Why "C:\Documents and" is missingThanks for any help
g-alex Posted August 22, 2005 Author Posted August 22, 2005 Ok, I founded, I've just used the tab and the space as you wrote in the comment of the batch file.Now the variable has the value "c:\documents and settings\alex\desktop"But I need to use the variable also for all users so I've tried the following:@ECHO OFFFOR /F "tokens=2* delims=" %%A IN ('REG QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Common Desktop') DO SET ComDesktop=%%BECHO Common Desktop=%ComDesktop%PAUSEBut I didnt made it, i'm getting an error "Too many command-line parameters".Also I want to know what is %%A, %%B and if I want 2 or more variables must these letters be changedThanks
glugolian Posted August 22, 2005 Posted August 22, 2005 (edited) Ok, I founded, I've just used the tab and the space as you wrote in the comment of the batch file.Now the variable has the value "c:\documents and settings\alex\desktop"But I need to use the variable also for all users so I've tried the following:@ECHO OFFFOR /F "tokens=2* delims=" %%A IN ('REG QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Common Desktop') DO SET ComDesktop=%%BECHO Common Desktop=%ComDesktop%PAUSEBut I didnt made it, i'm getting an error "Too many command-line parameters".Also I want to know what is %%A, %%B and if I want 2 or more variables must these letters be changedThanks<{POST_SNAPBACK}>Have solution for my problem@ECHO OFF:: delims is tab folowed by spaceFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\id\Doom 3" /v InstallPath') DO SET InstallPath=%%BECHO InstallPath=%InstallPath%COPY .\CRACKOP.txt "%InstallPath%"IF EXIST "%InstallPath%"\CRACKOP.txt (START .\first.txt GOTO END) ELSE START .\second.cmd:ENDIm not sure what you tried to do. Can you give more details Edited August 22, 2005 by glugolian
g-alex Posted August 22, 2005 Author Posted August 22, 2005 (edited) I've just want to create variables for desktop and common desktop, because I'm using 2 versions of Windows Greek and English, and the folder names are different.I've made it with the variable for the desktop, but I cannot make it for Common Desktop as I described.I'm keeping the ECHO command which is useless for what I do but is the way to check if the variable has the correct value. After this I will delete or copy shortcuts from desktop using these variables. Edited August 22, 2005 by g-alex
Doc Symbiosis Posted August 22, 2005 Posted August 22, 2005 You can use the following script to put the path to desktop of the current user into the variable desktop:@echo offsetlocal enableextensionsfor /f "tokens=*" %%a in ( 'reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v desktop') do ( set myvar=%%a)set desktop=%myvar:~15%echo /%%desktop%%=%desktop%pauseendlocalgoto :eofSimilarly you can get the other paths, but changing the regkey, which is read.
g-alex Posted August 22, 2005 Author Posted August 22, 2005 Doc Symbiosis, many thanks for your tries to help meI founded the solution to create variable for the path "C:\Documents and Settings\User\Desktop"But now I'm trying without success to create a variable for the common desktop "C:\Documents and Settings\All Users\Desktop" see my previous posts.I think the problem is when I'm trying to get the Value "Common Desktop" from the registry because it has a space.Thank you very much,
Doc Symbiosis Posted August 22, 2005 Posted August 22, 2005 You just have to set common desktop into quotes(") then evrything works fine.
g-alex Posted August 22, 2005 Author Posted August 22, 2005 (edited) Ok, I founded, When I used quotes the value was "REG_Z C:\Documents and Settings\All Users\Desktop" and finally I had to remove the space from 'delims' and i left only the tab. So now it is working fine the value is "C:\Documents and Settings\All Users\Desktop"I wonder what delims is, and why this happened.Thank you anyway Doc Symbiosis and glugolian, I wouldn't make it without your help. Edited August 22, 2005 by g-alex
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now