Discussion Locked

Loggin Script (2)

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Dear All,

I want to move C:\Documents and Settings\username\My Documents to D:\Documents and Settings\username\My Documents (from drive C: to D:). Is it possible to move it from loggin script?

Because I got some loggin script to move folder, but it doesn't work at all. And I really want to create this script only using batch file. I don't how to create loggin script, is it enough by using batch file or should use WMI or VB Scripts.
Could anyone help me? Before and after thankyou very much.

here I attach some loggin script to move folder that I have:

1.
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Scripts" , "M:\helpdesk\management"

2.(Using Shell Object)
Const FOF_CREATEPROGRESSDLG = &H0&
TargetFolder = "D:\Archive"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TargetFolder)
objFolder.MoveHere "C:\Scripts", FOF_CREATEPROGRESSDLG

3.Using WMI
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where name = 'c:\\Scripts'")
For Each objFolder in colFolders
errResults = objFolder.Rename("C:\Admins\Documents\Archive\VBScript")
Wscript.Echo errResults
Next

3 replies

by mikex

Only if you want to do it in a hard way :) - Otherwise:

To move My Documents folder to D: first Copy the folder to D: and then verify all the files are in D:\My Documents. Now right click on your My Documents folder on the Desktop and select Properties. In the box, change the path to D:\My Documents and click OK. Now you can open Windows Explorer, scroll to C:\Windows\My Documents and delete it to recover its space on C:.

by mikex

If you want to practice with the scripts:

The path to the My Documents folder is stored in the following registry key, where path is the complete path to your storage location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

Value Name: Personal
Value Type: REG_SZ
Value Data: path
Any modification from the default is recorded in the following location and the path listed earlier is also updated:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Value Name: Personal
Value Type: REG_SZ
Value Data: path

1. Create a .reg file with a changed settings
2. add the new .reg file to the registry with a batch file

by timothy.sharpe

I assume this is a windows network. The login script is a batch file. You creat the batch file ind place it in C:\WINNT\SYETM32\REPL\IMPORT\SCRIPTS for WINNT Server or C:\SYSVOL\SYSVOL\(Fully qualifiled domain name)\SCRIPTS for WIN 2000 Server AD. You have to point the user profile to the scripts (user manager for NT or Active Directory Users and Computers for 2000/AD)The line in the batch file would looklike this.

C:
CD\
xcopy C:\documents and settings\%username%\my documents d:\ /s /e /h /y

The %username% is a variable which will pipe in the users login name. Test it out. Also go to a DOS prompt and type in XCOPY /? for a list of the switches and what they do.

This discussion is closed to new replies.