Jump to content

Recommended Posts

Posted

Hi

 

i cant seem to get the re-direct favs script from the Wiki to work? IS there something wrong with my code?

 

i get the following error: line; 4,char;1, Error; object required: 'fso', code; 880a01a8, source; microsft Vbscript runtime error.

 

see my code below;

 

Create Favorites Folder

 

 

If Not fso.FolderExists("N:\MY Settings\Favorites") Then

call noFavorites

End If

 

sub noFavorites

filesys.CreateFolder "N:\MY Settings\Favorites"

END sub

 

'Re-Direct Favorites

 

' Variable Initilisations

Set objShell = CreateObject("WScript.Shell")

Set objNetwork = CreateObject("WScript.Network")

strUserName = objNetwork.UserName

strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"

strRedirectionPath = "N:\MY Settings\Favorites"

 

' Write the new Favorites path

objShell.RegWrite strRegKey, strRedirectionPath

 

' Variable Destruction

Set objShell = Nothing

Set objNetwork = Nothing

Posted

Set FSO = CreateObject("scripting.filesystemobject")

If Not fso.FolderExists("c:\Favorites") Then

call noFavorites

End If

 

sub noFavorites

fso.CreateFolder "c:\Favorites"

END sub

 

Should work.

  • Thanks 1
Posted
Set FSO = CreateObject("scripting.filesystemobject")

If Not fso.FolderExists("c:\Favorites") Then

call noFavorites

End If

 

sub noFavorites

fso.CreateFolder "c:\Favorites"

END sub

 

Should work.

 

Cheers my friend, that works fine now

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



×
×
  • Create New...