Jump to content

Filemove with @UserName Macro


Guest Peter
 Share

Recommended Posts

Guest Peter

Hi,

i've got a small Problem. I had to move a .lnk File from a various User Account to the All User Startmenu Tree. This is my Function. It doesn't work. How to get it work?

If FileExists ("C:\Dokumente und Einstellungen\" & @UserName

"\Startmenü\Programme\Microsoft Word Viewer.lnk") Then

FileMove ("C:\Dokumente und Einstellungen\" & @UserName "\Startmenü\Programme\Microsoft Word Viewer.lnk" , "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Microsoft Word Viewer.lnk")

EndIf

Thanks Peter

Link to comment
Share on other sites

Guest Doxie

I made a test myself, and it worked perfectly.

Almost the same code as you.

This is my code

If FileExists("C:\Documents and Settings\Doxie\Start Menu\Programs\test.lnk") Then
FileMove("C:\Documents and Settings\Doxie\Start Menu\Programs\test.lnk", "C:\Documents and Settings\All Users\Start Menu\Programs\test.ini")
EndIf

Don´t know why its not working for you?

Do you got admin rights when running the script?

Link to comment
Share on other sites

  • Developers

Did you Cut&Paste your code ?

There is a typo in this line:

FileMove ("C:\Dokumente und Einstellungen\" & @UserName & "\Startmenü\Programme\Microsoft Word Viewer.lnk" , "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Microsoft Word Viewer.lnk")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

you missed an &:

If FileExists ("C:\Dokumente und Einstellungen\" & @UserName &"\Startmenü\Programme\Microsoft Word Viewer.lnk") Then

FileMove ("C:\Dokumente und Einstellungen\" & @UserName & "\Startmenü\Programme\Microsoft Word Viewer.lnk" , "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Microsoft Word Viewer.lnk")

EndIf

you could also use @UserProfileDir.

as they say in the business; the first one's free:

If FileExists (@ProgramsDir & "\Microsoft Word Viewer.lnk") Then
   FileMove (@ProgramsDir & "\Microsoft Word Viewer.lnk" , @ProgramsCommonDir & "\Microsoft Word Viewer.lnk")
EndIf

Check out Macro Referance - Directory. in the ... you guessed it... Helpfile.

edited the code, fixed to @programsdir...

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

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...