Cmd file to rename a certain folder

Forum for anything else which doesn't fit in the above forums. Site feedback, random talk, whatever, are welcome.
Post Reply
User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Cmd file to rename a certain folder

Post by neuropass » Fri Jan 23, 2009 11:52 pm

hello guys i'm trying to rename a folder with a cmd file... but i can't get it work...


i tried these two path, but no luck... Any ideas guys...? i'm sure somebody of you guys know these stuff...


here what i tried already:

Code: Select all

ren "%USERPROFILE%\Music" "%USERPROFILE%\new folder name"

Code: Select all

CD /D %USERPROFILE%
REN Music "new folder name"

yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Sat Jan 24, 2009 12:08 am

ren "%USERPROFILE%\Music" "new folder name"
Image
My work list(Hosted by dumpydooby)

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 12:30 am

thanks for your reply... it doesn't work.. :cry:

i tried every thing....

User avatar
orcoxp
Posts: 532
Joined: Sun Apr 17, 2005 2:05 pm
Location: Ontario, Canada

Post by orcoxp » Sat Jan 24, 2009 1:01 am

%USERPROFILE%\Music works out to C:\Documents and Settings\USERNAME\

Are you intending on changing a folder called music in here?...cuz there is not normally a "music" folder there
Chris Thomson
AKA OrcoXP

PHP/MySQL/phpMyAdmin 2 & 3 successfully running simultaneously on XP SP3 IIS.

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 1:24 am

sorry i forgot to say that i'm using windows vista... so there is no document and setting... the path userprofile is c:\user\administrator\music

but i just found out something strange... i'm the administrator with highest privileges... but it won't change that music folder name with my name... i did a test creating a new folder in that directory and the nrun the cmd file... and guess what? it changed the name... so it won't change the name at the music folder though!!! this makes me insane!

how is that possible..??

So now my question is...

is it possible to add a new custom folder in the start menu trough the registry or cmd file..?


here a better example:

Image

yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Sat Jan 24, 2009 1:54 am

then it would be some stuff related to registry... i guess..

in my situation, c:\users\xxxxxx\music REALLY has been renamed, but the shell name in start menu stills Music.
Image
My work list(Hosted by dumpydooby)

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 8:15 am

the funny thing is that you can rename that folder manually but i couldn't change it with the cmd file.... and you'll see that changes after a reboot or user switch... i found the entry in the registry but even renominating the entry , the folder name didn't change... i don't know what to do... i would rather have a new folder but it seems that there is no way...

User avatar
code65536
Posts: 735
Joined: Wed Mar 14, 2007 2:58 pm
Location: .us
Contact:

Post by code65536 » Sat Jan 24, 2009 10:02 am

Renaming it from the command prompt from my Vista VPC works for me...

C:\Users\C64K>rename Music foo

Of course, the start menu item no longer works (since it's coded to look for "Music"). Also, renaming from the command prompt changes the file system name.

As for what gets displayed in the Windows Explorer and other shell components, these are special shell folders whose display name comes from a set of localized resources (if you installed a MUI, you will see that the displayed name changes, even if the file system name is still "Music") (you should be able to set which string table resource is used for the name, though I don't know enough about the Vista shell innards to tell you where exactly you will find that key). The point is that the Explorer name is detached from and independent of the file system name, for the purposes of allowing for l10n variation while maintaining file system integrity (imagine the havoc that would wreak on batch files if the file system name changed every time the user changed a MUI!). I suspect that changing the file system name isn't what you want.
My addons: CmdOpen - HashCheck - Notepad2 - MS Runtimes - DirectX

Into the breach, meatbags!

yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Sat Jan 24, 2009 10:20 am

code65536 wrote:Renaming it from the command prompt from my Vista VPC works for me...

C:\Users\C64K>rename Music foo

Of course, the start menu item no longer works (since it's coded to look for "Music"). Also, renaming from the command prompt changes the file system name.

As for what gets displayed in the Windows Explorer and other shell components, these are special shell folders whose display name comes from a set of localized resources (if you installed a MUI, you will see that the displayed name changes, even if the file system name is still "Music") (you should be able to set which string table resource is used for the name, though I don't know enough about the Vista shell innards to tell you where exactly you will find that key). The point is that the Explorer name is detached from and independent of the file system name, for the purposes of allowing for l10n variation while maintaining file system integrity (imagine the havoc that would wreak on batch files if the file system name changed every time the user changed a MUI!). I suspect that changing the file system name isn't what you want.
quite correct, this is what i was thinking since the cmd command i gave at post #2 really worked for me.
Image
My work list(Hosted by dumpydooby)

User avatar
ricktendo64
Posts: 3214
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sat Jan 24, 2009 10:34 am

No matter what the folder name for Music is it will always be called "Music", it uses desktop.ini to give it its name this way when you change the OS language it will be localized

You want to rename it rename it in the MUI (shell32.dll String #21790)

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 11:00 am

Thanks for the replies guys, i really appreciate it... i tried to change the name in shell32.dll.mui but after that when window restarted it reseted the name in the mui!!!! which means music!!


So i think this is happening because of the registry...

here what i found in the registry: (video folder example)

http://img299.imageshack.us/img299/4584/sfefecl9.jpg


So i'm trying to say that, if i change the name in the registry, the name in the shell32.dll.mui and the name in the shell32.dll (xml in it) and the name in the folder , all this in pre install environment (with WAIK) should work.... or will i waste 2 hours time????

User avatar
code65536
Posts: 735
Joined: Wed Mar 14, 2007 2:58 pm
Location: .us
Contact:

Post by code65536 » Sat Jan 24, 2009 1:36 pm

Did you read rick's post? It points out exactly where the string is stored. Your screenshot shows the same thing, too. The "Name" value is just a fallback for legacy apps; the shell and any properly behaving app will do a SHLoadIndirectString call on "@shell32.dll,-21790" (or whatever is in the "LocalizedName" value) and ignore "Name".

In the happy world of MUIs, whenever you try to load a string resource from system32\shell32.dll, the request actually gets redirected to system32\xxx\shell32.dll.mui, where "xxx" is the relevant language code, so if you want to edit the string, that is what you have to change. MUI files are basically like regular DLL files with a different extension (well, not quite, but for our intents and purposes, that's close enough). And you would edit the string table resource of a MUI file in the same way you would edit the string table resource of a DLL file: with a Windows resource editor.

If editing the shell resource sounds too dicey for you, there are alternatives:

1) Create your own resource DLL, place it whereever you want, and change the "LocalizedName" value to load the string from your custom dll instead of from shell32.dll (and its corresponding MUI)

2) Delete the "LocalizedName" value from the registry and force the system to use the legacy "Name" fallback value (not 100% sure if this would work; instead of deleting it, you are probably better off renaming it to "xxxLocalizedName" so that it's easy to undo if you have to).
My addons: CmdOpen - HashCheck - Notepad2 - MS Runtimes - DirectX

Into the breach, meatbags!

yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Sat Jan 24, 2009 2:05 pm

then why not make direct change to the registry?
Change the value of "LocalizedName" to what you expected. and then logoff then logon, to see if it works.


and the mui returned back maybe this is because of WFP.
Image
My work list(Hosted by dumpydooby)

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 2:33 pm

ok.. i tried to rename the mui file... the string of the music name... but nothing change... i think i messed up too much the registry and dll... so i need to reinstall windows vista.... and i'll try to change the mui in pre install environment and see how it gets...


But now i have another question... ho do you create your own dll??? is there any program to do that..?

thanks..

User avatar
code65536
Posts: 735
Joined: Wed Mar 14, 2007 2:58 pm
Location: .us
Contact:

Post by code65536 » Sat Jan 24, 2009 4:57 pm

Um, on Vista, there is no difference between changing it in pre-install and doing it post-install. If it doesn't work post-install, it will not work pre-install.

First, when you changed the LocalizedName value, you should change the name of the value to "xxxLocalizedName" so that the system will not find LocalizedName. If you keep it as LocalizedName but instead change the data associated with the value, then the system will find LocalizedName and then proceed to try to load a resource for a bogus location. Change the name of the value, not the data associate with the value!

If you did try to change the name of the value (or just delete the LocalizedName value itself) and it didn't work (it was just a theory; I hadn't tried it before), then your only options are to modify the MUI's resources or create your own resource DLL. There are plenty of resources online about how to do either of those two things, so I would suggest that you do some research...
My addons: CmdOpen - HashCheck - Notepad2 - MS Runtimes - DirectX

Into the breach, meatbags!

User avatar
neuropass
Posts: 123
Joined: Thu Oct 02, 2008 5:05 pm

Post by neuropass » Sat Jan 24, 2009 5:06 pm

i tried but no way... no it is not important... i would rather add a new folder there in that part of the menu.. but there is nothing in the registry about it... i really would like to do it.. i searched every where... i'm sure there the option in the registry, because you can do it manually drag and drop the folder there... i just managed to change the hint of that folder and it was in the explorer.exe.mui which is strange because i thought it was in the shell32.dll.mui...

Post Reply