Alguna variable que controla la ubicación de Mis Documentos?

17/07/2006 - 20:31 por David Leal | Informe spam
Hola a todos,

Me gustaría lanzar esta pregunta ya que no se muy bien cómo hay que proceder.

Yo he cambiado la ubicación de Mis Documentos a una partición del disco, en
cambio solamente cambia la ubicación de Mis Documentos dentro de la
información del usuario, o sea: C:\Documents and Settings\user\Mis
Documentos, pero en cambio mantiene el resto de los datos del usuario en la
vieja ubicación.

Si no hubiera hecho este cambio la ubicación de Mis Documentos habría sido:
%USERPROFILE%\Mis Documentos

pero en cambio habiendo cambiado la ubicación ya no tengo forma de saber de
forma programática dónde tengo la carpeta.

Por otro lado la variable USERPROFILE no puede ser cambiada por el usuario
ya que no aparece entre las variables a configurar y seguramente debe ser
peligroso hacerlo en caso que se pueda. Ya que en su momento lo pensé en caso
de poder cambiar la ubicación de esta variable, mover toda la información del
usuario, no solamente la carpeta de mis documentos a la nueva ubicación que
es apuntada por el nuevo valor de USERPROFILE.

Muchas Gracias por alguna sugerencia,

David

Nota:
Para cambiar la ubicación de la carpeta Mis Documentos, por ejemplo en
Explorador de Archivos, botón derecho sobre Mis Documentos y en el campo de
Destino colocar la nueva ubicación y mover dicha información. Esto es muy
útil ya que si tenemos los discos particionados, podemos colocar la
información del usuario en una ubicación distinta a la ubicación del sistema
operativo.

Preguntas similare

Leer las respuestas

#11 Jose Gallardo
18/07/2006 - 18:50 | Informe spam
Ejecútalo, entonces así:

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders" \Personal

Microsoft MVP Windows - Shell/User
www.fermu.com


"David Leal" wrote in message
news:
Jose te adjunto la salida...

"Jose Gallardo" escribió:

Si en "cmd" escribes

reg query /?

¿Qué información te da?


C:\Documents and Settings\X017735>reg query /?

Command-line registry manipulation utility version 1.10.
Copyright Microsoft Corporation 1997. All rights reserved.

REG QUERY RegistyPath [\\Machine] ["String"] [/S] [/size] [/list]

RegistryPath [ROOTKEY\]Key[\'ValueName']
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
Optional. When omitted HKLM is assumed.
Key The full name of a registry key under the selected ROOTKEY.
ValueName The value, under the selected Key, to query.
Optional. When omitted all keys and values under the Key
are listed.
Enclose ValueNames that containg the \ character in single
quotes.
Machine Name of remote machine - omitting defaults to current
machine.
Only HKLM and HKU are available on remote machines.
/S, /s Queries all subkeys.
/size Queries the size of RegistryPath
/list Search strings from RegistryPath

Examples:

REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup\InstallDir
Displays the value of the InstallDir registry entry.

REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /S
Displays all keys and values under the Setup sub-key.
Respuesta Responder a este mensaje
#12 David Leal
19/07/2006 - 19:20 | Informe spam
Ejecutado, pero el resultado no es el esperado. Según te entiendo entonces la
sintaxis no es la misma para Windows XP que para Windows 2000, entonces
tendré que poder detectar la versión del sistema operativo en mi script, no?,
sabes como se hace esto, pero vamos esto es otro tema, a ver si conseguimos
primero esto, no? Gracias.

Yo entiendo que debería salir el valor de la varible Personal que es la que
almacena la ubicación que quiero y no la lista de propiedades dentro de User
Shell Folders.

C:\Documents and Settings\X017735>reg query
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
\Personal

Listing of [Software\Microsoft\Windows\CurrentVersion\Explorer\\User Shell
Folders]

EXPAND_SZ AppData %USERPROFILE%\Application Data
EXPAND_SZ Desktop %USERPROFILE%\Desktop
EXPAND_SZ Favorites %USERPROFILE%\Favorites
EXPAND_SZ NetHood %USERPROFILE%\NetHood
EXPAND_SZ Personal d:\My Documents
EXPAND_SZ PrintHood %USERPROFILE%\PrintHood
EXPAND_SZ Programs %USERPROFILE%\Start Menu\Programs
EXPAND_SZ Recent %USERPROFILE%\Recent
EXPAND_SZ SendTo %USERPROFILE%\SendTo
EXPAND_SZ Start Menu %USERPROFILE%\Start Menu
EXPAND_SZ Startup %USERPROFILE%\Start Menu\Programs\Startup
EXPAND_SZ Templates %USERPROFILE%\Templates
REG_SZ My Pictures d:\My Documents\My Pictures
EXPAND_SZ Local Settings %USERPROFILE%\Local Settings
EXPAND_SZ Local AppData %USERPROFILE%\Local Settings\Application Data
EXPAND_SZ Cache %USERPROFILE%\Local Settings\Temporary Internet Files
EXPAND_SZ Cookies %USERPROFILE%\Cookies
EXPAND_SZ History %USERPROFILE%\Local Settings\History
[New]

C:\Documents and Settings\X017735>



"Jose Gallardo" escribió:

Ejecútalo, entonces así:

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders" \Personal

Microsoft MVP Windows - Shell/User
www.fermu.com


"David Leal" wrote in message
news:
> Jose te adjunto la salida...
>
> "Jose Gallardo" escribió:
>
>> Si en "cmd" escribes
>>
>> reg query /?
>>
>> ¿Qué información te da?
> C:\Documents and Settings\X017735>reg query /?
>
> Command-line registry manipulation utility version 1.10.
> Copyright Microsoft Corporation 1997. All rights reserved.
>
> REG QUERY RegistyPath [\\Machine] ["String"] [/S] [/size] [/list]
>
> RegistryPath [ROOTKEY\]Key[\'ValueName']
> ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
> Optional. When omitted HKLM is assumed.
> Key The full name of a registry key under the selected ROOTKEY.
> ValueName The value, under the selected Key, to query.
> Optional. When omitted all keys and values under the Key
> are listed.
> Enclose ValueNames that containg the \ character in single
> quotes.
> Machine Name of remote machine - omitting defaults to current
> machine.
> Only HKLM and HKU are available on remote machines.
> /S, /s Queries all subkeys.
> /size Queries the size of RegistryPath
> /list Search strings from RegistryPath
>
> Examples:
>
> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup\InstallDir
> Displays the value of the InstallDir registry entry.
>
> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /S
> Displays all keys and values under the Setup sub-key.



Respuesta Responder a este mensaje
#13 Jose Gallardo
19/07/2006 - 19:27 | Informe spam
A lo mejor no debe llevar espacio. Prueba a quitar el espacio que hay entre
la " y la \

Microsoft MVP Windows - Shell/User
www.fermu.com


"David Leal" wrote in message
news:
Ejecutado, pero el resultado no es el esperado. Según te entiendo entonces
la
sintaxis no es la misma para Windows XP que para Windows 2000, entonces
tendré que poder detectar la versión del sistema operativo en mi script,
no?,
sabes como se hace esto, pero vamos esto es otro tema, a ver si
conseguimos
primero esto, no? Gracias.

Yo entiendo que debería salir el valor de la varible Personal que es la
que
almacena la ubicación que quiero y no la lista de propiedades dentro de
User
Shell Folders.

C:\Documents and Settings\X017735>reg query
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell
Folders"
\Personal

Listing of [Software\Microsoft\Windows\CurrentVersion\Explorer\\User Shell
Folders]

EXPAND_SZ AppData %USERPROFILE%\Application Data
EXPAND_SZ Desktop %USERPROFILE%\Desktop
EXPAND_SZ Favorites %USERPROFILE%\Favorites
EXPAND_SZ NetHood %USERPROFILE%\NetHood
EXPAND_SZ Personal d:\My Documents
EXPAND_SZ PrintHood %USERPROFILE%\PrintHood
EXPAND_SZ Programs %USERPROFILE%\Start Menu\Programs
EXPAND_SZ Recent %USERPROFILE%\Recent
EXPAND_SZ SendTo %USERPROFILE%\SendTo
EXPAND_SZ Start Menu %USERPROFILE%\Start Menu
EXPAND_SZ Startup %USERPROFILE%\Start Menu\Programs\Startup
EXPAND_SZ Templates %USERPROFILE%\Templates
REG_SZ My Pictures d:\My Documents\My Pictures
EXPAND_SZ Local Settings %USERPROFILE%\Local Settings
EXPAND_SZ Local AppData %USERPROFILE%\Local Settings\Application
Data
EXPAND_SZ Cache %USERPROFILE%\Local Settings\Temporary Internet
Files
EXPAND_SZ Cookies %USERPROFILE%\Cookies
EXPAND_SZ History %USERPROFILE%\Local Settings\History
[New]

C:\Documents and Settings\X017735>



"Jose Gallardo" escribió:

Ejecútalo, entonces así:

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders" \Personal

Microsoft MVP Windows - Shell/User
www.fermu.com


"David Leal" wrote in message
news:
> Jose te adjunto la salida...
>
> "Jose Gallardo" escribió:
>
>> Si en "cmd" escribes
>>
>> reg query /?
>>
>> ¿Qué información te da?
> C:\Documents and Settings\X017735>reg query /?
>
> Command-line registry manipulation utility version 1.10.
> Copyright Microsoft Corporation 1997. All rights reserved.
>
> REG QUERY RegistyPath [\\Machine] ["String"] [/S] [/size] [/list]
>
> RegistryPath [ROOTKEY\]Key[\'ValueName']
> ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
> Optional. When omitted HKLM is assumed.
> Key The full name of a registry key under the selected
> ROOTKEY.
> ValueName The value, under the selected Key, to query.
> Optional. When omitted all keys and values under the
> Key
> are listed.
> Enclose ValueNames that containg the \ character in
> single
> quotes.
> Machine Name of remote machine - omitting defaults to current
> machine.
> Only HKLM and HKU are available on remote machines.
> /S, /s Queries all subkeys.
> /size Queries the size of RegistryPath
> /list Search strings from RegistryPath
>
> Examples:
>
> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup\InstallDir
> Displays the value of the InstallDir registry entry.
>
> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /S
> Displays all keys and values under the Setup sub-key.



Respuesta Responder a este mensaje
#14 David Leal
20/07/2006 - 22:55 | Informe spam
Hola,

De windows 2000, he desistido un poco, bajo Windows XP, mirando la sintaxis
de reg query, obtengo la siguiente salida:

C:\Documents and Settings\david>reg query
"HKCU\Software\Microsoft\Windows\Curre
ntVersion\Explorer\User Shell Folders" /v Personal

Personal REG_EXPAND_SZ D:\usr\david

pero esta información se muestra, pero como almacenar el tercer campo que se
muestra en un variable?

Gracias,

David
Respuesta Responder a este mensaje
#15 Jose Gallardo
21/07/2006 - 19:34 | Informe spam
Veamos si te sirve esto. Guarda el contenido que hay entre líneas en un
archivo con el nombre que quieras pero con extensión cmd. Ejecútalo desde la
consola de comandos. Las líneas no se copian. El contenido de mismo
documentos está guardado en la variable "misdocs":
-
@echo off
setlocal
FOR /f "skip=4 tokens=3,4" %%A IN ('reg query
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
/v Personal') DO SET misdocs=%%A %%B
echo "Mis Documentos esta en" %misdocs%
endlocal
-

Microsoft MVP Windows - Shell/User
www.fermu.com


"David Leal" wrote in message
news:
Hola,

De windows 2000, he desistido un poco, bajo Windows XP, mirando la
sintaxis
de reg query, obtengo la siguiente salida:

C:\Documents and Settings\david>reg query
"HKCU\Software\Microsoft\Windows\Curre
ntVersion\Explorer\User Shell Folders" /v Personal

Personal REG_EXPAND_SZ D:\usr\david

pero esta información se muestra, pero como almacenar el tercer campo que
se
muestra en un variable?

Gracias,

David
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una pregunta AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida