Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


MoveFileEx() and GetMultiStringValue

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3595
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MoveFileEx() and GetMultiStringValue
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 MoveFileEx() and GetMultiStringValue - 6/30/2005 11:34:37 AM   
  Timshel

 

Posts: 4
Score: 0
Joined: 3/7/2003
From: Australia
Status: offline
I have 2 questions...
1. I have seen mention of a function known as MoveFileEx() which I would be
interested to use to move/replace a file currently in use. Is this available
within VBScript, and if so, how do get to it??

2. In the absence of MoveFileEx() I have attempted to use the
'PendingFileRenameOperations' registry value to move/replace a file in use.
This is a Multi String value under
'HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\SESSION MANAGER\'.
I can create this value and populate it with the necessary information using
the SetMultiStringValue function from WMI's 'StdRegProv'. Additionally I
would like to append my entries to any existing entries, for which I have
used 'GetMultiStringValue' to retrieve the info first. This works fine
however, I encounter issues when there are blank entries in the value - which
I understand is used by some install programs to delete files in use. Only
the entries before the blank are returned by 'GetMultiStringValue' anything
after this is excluded. This problem is apparent on Win2K but not on WinXP.

Any info is greatly appreciated...

Cheers,

Timshel
 
 
Post #: 1
 
 Re: MoveFileEx() and GetMultiStringValue - 6/30/2005 12:54:35 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
replace a file inuse

http://www.spoogenet.com/index.php?module=article&view=5&5cbaa9d36385e275f0a415eb9b827618=770550be7b99869d2f28617edf1380a7

(in reply to Timshel)
 
 
Post #: 2
 
 Re: MoveFileEx() and GetMultiStringValue - 6/30/2005 4:20:16 PM   
  Timshel

 

Posts: 4
Score: 0
Joined: 3/7/2003
From: Australia
Status: offline
Thanks for the link but it's not going to work for me...

OK... so I haven't been clear about what I'm trying to do...[:I]

I actually want to delete a user profile folder, however this folder contains files in use at the time the script runs. I therefore need to be able to effectively move it during system startup. Hence looking at 'MoveFileEx' and PendingFileRenameOperations reg key.

My current script uses PendingFileRenameOperations key to move the folder to 'C:\deleteme\oldprofile\... and then deletes the folder by running 'cmd /c RD /s /q C:\Deleteme'.

This is fine except that I thought I'd be clever and append my 'PendingRename...' operations to any existing entries. To do this I read the current values using the 'GetMultiStringValue' function... and then add my entries to the array before writing it back in using 'SetMultiStringValue'. This works fine for both XP and 2K until the registry value has null lines.

Null lines in this multi string value are used to delete files instead of renaming them. This is common among application install programs. Note that RegEdit and Regedt32 both consider Null lines as illegal and will strip them...

Null lines isn't an issue for my script under XP. However, under 2K GetMultiStringValue will only return the strings prior to the null line.

Does anyone know if WMI can be updated on Win2K so it behaves the same as XP?? (I suspect not)

Can anyone offer an alternative to solve my situation??

Cheers,

Timshel

(in reply to Timshel)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MoveFileEx() and GetMultiStringValue Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts