0

Hi Daniwebbers!

I'm trying to copy a file from a network location to a local file folder on a laptop. The following script will work to put the file into the documents folder of the users profile.

xcopy /y /d "\\networkaddress\tablet config.exe" "c:\users\%username%\documents\"

That will put the file tablet config.exe into the documents folder. The problem is I want it in c:\programdata\microsoft\windows\start menu\programs so when you go to the start menu and type in tabet config it appears under programs, not documents.

When I change the destination to that, it doesn't work. The file doesn't go anywhere. The only thing I can think of is because it requires elevation to copy files to that folder and I'm not sure how to make it work.

Does anyone know how to make a file copy to c:\programdata\microsoft\windows\start menu\programs using a script?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Reverend Jim
0

First of all, you shouldn't copy actual executables to that location. If you have a look you will see that it has "lnk" files there which are shortcuts to the actual executable files. So for starters you could create just a shortcut there and put the executable anywhere. If the users will always be connected to the network then the shortcut could be created to point to the network location.

More later - I have to go look at show-homes.

0

You can create a shortcut using the following vbScript code. You can also code this into VB.

set wso = CreateObject("Wscript.Shell")
folder = wso.SpecialFolders("StartMenu")

set shortcut = wso.CreateShortcut(folder & "\myconfig.lnk")
shortcut.TargetPath = "\\networkaddress\tablet config.exe"
shortcut.Arguments = ""
shortcut.Description = "tooltip descriptive text"
shortcut.WorkingDirectory = "\\networkaddress\tablet config.exe"
shortcut.Save

If you want to copy the exe to a local folder then change the value of shortcut.TargetPath and shortcut.WorkingDirectory. There are other values that you can use for SpecialFolders such as

AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.