Jump to content

How to Move the My Documents Folder (Window 10)


Trong
 Share

Recommended Posts

If $IsNewOS Then
        $DocumentsDir = @UserProfileDir & "\Documents"
    Else
        $DocumentsDir = @UserProfileDir & "\My Documents"
EndIf

    Local $KEY_Explorer = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer"
    RegWrite($KEY_Explorer & "\User Shell Folders", "Personal", "REG_EXPAND_SZ", $DocumentsDir)
    RegWrite($KEY_Explorer & "\User Shell Folders", "My Video", "REG_EXPAND_SZ", $DocumentsDir & "\Videos")
    RegWrite($KEY_Explorer & "\User Shell Folders", "My Music", "REG_EXPAND_SZ", $DocumentsDir & "\Music")
    RegWrite($KEY_Explorer & "\User Shell Folders", "My Pictures", "REG_EXPAND_SZ", $DocumentsDir & "\Pictures")
    RegWrite($KEY_Explorer & "\User Shell Folders", "Favorites", "REG_EXPAND_SZ", $DocumentsDir & "\Favorites")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}", "REG_EXPAND_SZ", $DocumentsDir & "\Links")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}", "REG_EXPAND_SZ", $DocumentsDir & "\Searches")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{56784854-C6CB-462B-8169-88E350ACB882}", "REG_EXPAND_SZ", $DocumentsDir & "\Contacts")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{374DE290-123F-4565-9164-39C4925E467B}", "REG_EXPAND_SZ", $DocumentsDir & "\Downloads")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}", "REG_EXPAND_SZ", $DocumentsDir & "\Saved Games")
    RegWrite($KEY_Explorer & "\User Shell Folders", "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}", "REG_EXPAND_SZ", $DocumentsDir & "\Libraries")
    RegWrite($KEY_Explorer & "\Shell Folders", "Personal", "REG_SZ", $DocumentsDir)
    RegWrite($KEY_Explorer & "\Shell Folders", "My Video", "REG_SZ", $DocumentsDir & "\Videos")
    RegWrite($KEY_Explorer & "\Shell Folders", "My Music", "REG_SZ", $DocumentsDir & "\Music")
    RegWrite($KEY_Explorer & "\Shell Folders", "My Pictures", "REG_SZ", $DocumentsDir & "\Pictures")
    RegWrite($KEY_Explorer & "\Shell Folders", "Favorites", "REG_SZ", $DocumentsDir & "\Favorites")
    RegWrite($KEY_Explorer & "\Shell Folders", "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}", "REG_SZ", $DocumentsDir & "\Links")
    RegWrite($KEY_Explorer & "\Shell Folders", "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}", "REG_SZ", $DocumentsDir & "\Searches")
    RegWrite($KEY_Explorer & "\Shell Folders", "{56784854-C6CB-462B-8169-88E350ACB882}", "REG_SZ", $DocumentsDir & "\Contacts")
    RegWrite($KEY_Explorer & "\Shell Folders", "{374DE290-123F-4565-9164-39C4925E467B}", "REG_SZ", $DocumentsDir & "\Downloads")
    RegWrite($KEY_Explorer & "\Shell Folders", "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}", "REG_SZ", $DocumentsDir & "\Saved Games")
    RegWrite($KEY_Explorer & "\Shell Folders", "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}", "REG_SZ", $DocumentsDir & "\Libraries")
    
    ReStarExplorer()

 

Edited by Trong

Regards,
 

Link to comment
Share on other sites

Link to comment
Share on other sites

I too find issues with having my scripts work under Windows 10

I think we both have Administrator accounts ?

That could be part of the problem because allot of Windows stuff is actually APPs that dont work unless you are a regular user.

Kinda sucks but i think nerds are screwed and gonna go back to W7

 

Let me know what u fin dout. Try normal user.

Link to comment
Share on other sites

Look in the registry for the ShellFolders entries, there's a registry key called "!Do not use this registry key" and directs you to "Use the SHGetFolderPath or SHGetKnownFolderPath function instead". That tells me that Windows 10 doesn't use these as anything other than pointers for other programs to use, if you want to set them you should probably be using SHSetKnownFolderPath to change them.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

OK i am now totally confused with this guy.

So your script cant see UserProfileDir & "\Documents" ?

$result = FileExists (@UserProfileDir & "\Documents")
MsgBox (0,'',$result)

returns 1 so it works.

I dontk now what does

$IsNewOS

stands for and how its implemented into your script.
You are asking for answer of a question you never asked.

Link to comment
Share on other sites

@tonycstDo not care to this code, it's just a part of my program. 

; $IsNewOS = FuncCheckOS() 
; Set MyDocument Path for restore.
If $IsNewOS Then
        $DocumentsDir = @UserProfileDir & "\Documents"
    Else
        $DocumentsDir = @UserProfileDir & "\My Documents"
EndIf


@KingBobI will learn how to use it:  SHSetKnownFolderPath

Regards,
 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...