Yzöwl Posted May 20, 2005 Share Posted May 20, 2005 Just on the off chance that the desktop.ini may help, here is the contents of the ones which may help. What are the differences with yours?My Documents[DeleteOnCopy]Owner=<%UserName%>Personalized=5PersonalizedName=My DocumentsMy Music[DeleteOnCopy]Owner=<%UserName%>Personalized=13PersonalizedName=My Music[.ShellClassInfo]InfoTip=@Shell32.dll,-12689IconFile=%SystemRoot%\system32\SHELL32.dllIconIndex=-237My Pictures[DeleteOnCopy]Owner=<%UserName%>Personalized=39PersonalizedName=My Pictures[.ShellClassInfo]InfoTip=@Shell32.dll,-12688IconFile=%SystemRoot%\system32\mydocs.dllIconIndex=-101Obviously the username is variable, but may be part of the search criteria! Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 20, 2005 Author Share Posted May 20, 2005 Just on the off chance that the desktop.ini may help, here is the contents of the ones which may help. What are the differences with yours?...Obviously the username is variable, but may be part of the seargh criteria!<{POST_SNAPBACK}>My Documents[.ShellClassInfo]IconFile=%SystemRoot%\system32\SHELL32.dllIconIndex=126My Music[DeleteOnCopy]Owner=BenPersonalized=13PersonalizedName=My Music[.ShellClassInfo]InfoTip=@Shell32.dll,-12689IconFile=%SystemRoot%\system32\SHELL32.dllIconIndex=-237My Pictures[.ShellClassInfo]InfoTip=@Shell32.dll,-12688IconFile=%SystemRoot%\system32\SHELL32.dllIconIndex=127[DeleteOnCopy]Owner=BenPersonalized=39PersonalizedName=My PicturesThe desktop.ini from my computer is probably different since I have been synchronizing between my desktop and laptop computer. Link to comment Share on other sites More sharing options...
Yzöwl Posted May 20, 2005 Share Posted May 20, 2005 Have you redirected your My Music and My Pictures, or are they still in %UserProfile%? Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 20, 2005 Author Share Posted May 20, 2005 My Music and My Pictures are in My Documents, so they are also redirected.My Music used to be on a seperate drive though (so also redirected). Link to comment Share on other sites More sharing options...
spiritpyre Posted May 20, 2005 Share Posted May 20, 2005 I don't know if its crucial that you have it search for some tag file in a directory (i.e. if you would have many PCs to do this on) or if you might be willing to consider alternatives (shortcuts you can get away with if number of PCs is small). But one idea that immediately came to mind on reading your post was that if you didn't have many variations on this (ie. perhaps you had 3 locations on different pcs something like: E:\blah1 , I:\HiddenInSomeHorriblyLongName\blah2 , & the default mydocs path) then you could easily get away with some if statements to check whether or not you custom locations exists and if not to use the default.IF EXIST "E:\blah1" GOTO Type1IF EXIST "I:\HiddenInSomeHorriblyLongName\blah2" GOTO Type2:Add Conditions for Default MyDocs Heremaybe reg add something or other:Type1blahblahblahGOTO Somewhere:Type2qwertyGOTO Elsewhereyeah... i know i'm lazy but you get the idea.Don't know if you would want to use something like that but I'm fond of thinking of quick cheapies if not then i'm sure somebody smarter than me will have a better answer for you... Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 21, 2005 Author Share Posted May 21, 2005 I don't know if its crucial that you have it search for some tag file in a directory (i.e. if you would have many PCs to do this on) or if you might be willing to consider alternatives (shortcuts you can get away with if number of PCs is small). But one idea that immediately came to mind on reading your post was that if you didn't have many variations on this (ie. perhaps you had 3 locations on different pcs something like: E:\blah1 , I:\HiddenInSomeHorriblyLongName\blah2 , & the default mydocs path) then you could easily get away with some if statements to check whether or not you custom locations exists and if not to use the default.IF EXIST "E:\blah1" GOTO Type1IF EXIST "I:\HiddenInSomeHorriblyLongName\blah2" GOTO Type2:Add Conditions for Default MyDocs Heremaybe reg add something or other:Type1blahblahblahGOTO Somewhere:Type2qwertyGOTO Elsewhereyeah... i know i'm lazy but you get the idea.Don't know if you would want to use something like that but I'm fond of thinking of quick cheapies if not then i'm sure somebody smarter than me will have a better answer for you... <{POST_SNAPBACK}>I actually thought of a batch script that could do it initially, but the problem is that I have NO CLUE whatsoever how to write such a batch.That's why I turned here .Since I'm not very good in all this scripting, batch-files, .exe files, and all that kind of stuff, please forgive me for the following question:Is it really hard to code/create a program/script/batch/whatever that searches drives for a tag-file (at root or at root\somefolder) and if found, makes the necessary registry corrections? (Not taking into account a computer with multiple users). Link to comment Share on other sites More sharing options...
Dahi Posted May 22, 2005 Share Posted May 22, 2005 Is it really hard to code/create a program/script/batch/whatever that searches drives for a tag-file (at root or at root\somefolder) and if found, makes the necessary registry corrections? (Not taking into account a computer with multiple users).To get you started, this batch will find all tagfiles on any drive. For your homework, just add the registry correction bit, select a suitable tagfile, and youre done @echo offset TAGFILE=desktop.iniFOR %%D IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%D:\NUL ( echo Checking %%D: pushd "%%D:\" FOR /F "USEBACKQ DELIMS==" %%I IN (`DIR /S /B /a:h %TAGFILE%`) DO ( echo Found tagfile "%%I" ) popd ))pause Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 22, 2005 Author Share Posted May 22, 2005 To get you started, this batch will find all tagfiles on any drive. For your homework, just add the registry correction bit, select a suitable tagfile, and youre done @echo offset TAGFILE=desktop.iniFOR %%D IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%D:\NUL ( echo Checking %%D: pushd "%%D:\" FOR /F "USEBACKQ DELIMS==" %%I IN (`DIR /S /B /a:h %TAGFILE%`) DO ( echo Found tagfile "%%I" ) popd ))pause<{POST_SNAPBACK}>Thanks .A few questions concerning this though:1. does this return a variable that I can use to put in the registry entry?2. what does the "popd" do?3. Why is the "NUL" in "IF EXIST %%D:\NUL"?4. What does the "USEBACKQ DELIMS==" do?Thanks again . Link to comment Share on other sites More sharing options...
Dahi Posted May 23, 2005 Share Posted May 23, 2005 A few questions concerning this though:1. does this return a variable that I can use to put in the registry entry?2. what does the "popd" do?3. Why is the "NUL" in "IF EXIST %%D:\NUL"?4. What does the "USEBACKQ DELIMS==" do?1. Nope. You could put the username in the tagfile and retrieve it with a FOR command.2. Pushd changes to the specified directory. Popd returns to the original directory. Every pushd needs a corresponding popd.3. NUL was required in older versions of MSDOS. It looks like its not required in WinXP batch files. 4. Usebackq changes the FOR command to process strings in back-quotes as commands (like Unix). Delims== sets the delimiter to = so that filenames with spaces are not broken into words by default.Type FOR /? in a command prompt window for more info. Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 23, 2005 Author Share Posted May 23, 2005 A few questions concerning this though:1. does this return a variable that I can use to put in the registry entry?2. what does the "popd" do?3. Why is the "NUL" in "IF EXIST %%D:\NUL"?4. What does the "USEBACKQ DELIMS==" do?1. Nope. You could put the username in the tagfile and retrieve it with a FOR command.2. Pushd changes to the specified directory. Popd returns to the original directory. Every pushd needs a corresponding popd.3. NUL was required in older versions of MSDOS. It looks like its not required in WinXP batch files. But anyone booting with a Win98 floppy might need it.4. Usebackq changes the FOR command to process strings in back-quotes as commands (like Unix). Delims== sets the delimiter to = so that filenames with spaces are not broken into words by default.Type FOR /? in a command prompt window for more info.<{POST_SNAPBACK}>Is it possible then to have it return a variable that I can use in a regsistry-key? Link to comment Share on other sites More sharing options...
Dahi Posted May 23, 2005 Share Posted May 23, 2005 Put your username in a file called username.txt in your My Documents folder.@echo offset TAGFILE=username.txtFOR %%D IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%D:\NUL ( echo Checking %%D: pushd "%%D:\" FOR /F "USEBACKQ DELIMS==" %%I IN (`DIR /S /B %TAGFILE%`) DO ( echo Tagfile: %%I for /F "usebackq delims==" %%J in ( "%%I" ) do ( echo Username: "%%J" echo Directory: %%~dI%%~pI ) ) popd ))pause Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 23, 2005 Author Share Posted May 23, 2005 Put your username in a file called username.txt in your My Documents folder.@echo offset TAGFILE=username.txtFOR %%D IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%D:\NUL ( echo Checking %%D: pushd "%%D:\" FOR /F "USEBACKQ DELIMS==" %%I IN (`DIR /S /B %TAGFILE%`) DO ( echo Tagfile: %%I for /F "usebackq delims==" %%J in ( "%%I" ) do ( echo Username: "%%J" echo Directory: %%~dI%%~pI ) ) popd ))pause<{POST_SNAPBACK}>OK, you totally lost me... Does it mean that I can use I%% in a registry entry so that My Documents is automatically set to the right directory?I seriously have no clue... Thank you very much for your help though EDIT: OK, I've been doing some trying and that kind of things, seems to me that I only need something likeSET DOCSFOLDER=??? at the end, after the last closing ).The only question is, what?I've tried %%D, I've tried %%I, I've tried %%~dI%%~pI...DOCSFOLDER should return the folder where it found the tagfile in...Thanks again in advance. Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 24, 2005 Author Share Posted May 24, 2005 Edited above post, see there.For completeness, the edit:OK, I've been doing some trying and that kind of things, seems to me that I only need something likeSET DOCSFOLDER=???at the end, after the last closing ).The only question is, what?I've tried %%D, I've tried %%I, I've tried %%~dI%%~pI...DOCSFOLDER should return the folder where it found the tagfile in...Thanks again in advance. Link to comment Share on other sites More sharing options...
Yzöwl Posted May 24, 2005 Share Posted May 24, 2005 instead of echo Directory: change it to SET DOCSFOLDER=You should then be able to use %DOCSFOLDER% as the variable to put into your registry entry Link to comment Share on other sites More sharing options...
Ben.Hahlen Posted May 24, 2005 Author Share Posted May 24, 2005 Wonderfull!It seems to work as a charm.Now to implement it into my unattended DVD, and I'm all done . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now