/build/static/layout/Breadcrumb_cap_w.png

File rename using a .vbs

I need to rename a number of files after an msi is installed. I need them renaming after the install due to Radia not liking the file extension # at deployment do it fails.

I have conclusded a Custom Action to do this via a .vbs is the best option.

Can a file rename be done using vbs? if so can anyone let me know the scrit to do this, cannot fine the command for a file rename.

many thanks in advance.

Files to be renamed are as follows :


C:\PROGRAM FILES\PROPH_73\FULL_ACC\PRECOMP\BorelandWatr.01 to BorelandWatr.01
BorelandWatr.02 to BorelandWatr.02
BorelandWatrD.00 to BorelandWatrD.00
BorelandWatrD.01 to BorelandWatrD.01

Renamed to BorelandWatr.01 to BorelandWatr.#01
BorelandWatr.02 to BorelandWatr.#02
BorelandWatrD.00 to BorelandWatrD.#00
BorelandWatrD.01 to BorelandWatrD.#01


big cheers in advance.

0 Comments   [ + ] Show comments

Answers (6)

Posted by: brenthunter2005 17 years ago
Fifth Degree Brown Belt
0
You can't rename a file using VBScript natively, but you can "move" the file to the new file name.


Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\temp\file1.txt", "C:\temp\file_with_new_name.doc"
Posted by: knight 17 years ago
Orange Senior Belt
0
Hi TOBES_UK,

try this script

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\1.txt" , "C:\2.txt"

(Move file is like renaming a file)

Hope it works,
knight
Posted by: gmorgan618 17 years ago
Blue Belt
0
If the installation requires a reboot you could use the FileRenameOperations under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager key to do the rename operation.
Posted by: TOBES_UK 17 years ago
Senior Purple Belt
0
Cheers guys, u've given me some superb info to be cracking on with :)
Posted by: looeee 17 years ago
Senior Yellow Belt
0
Have you considered using the MoveFiles Table for this?
Posted by: AngelD 17 years ago
Red Belt
0
If you do rename these make sure they are not set a the keypath for the component, if they are they will get repaired.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ