Question Locked

Help with VBS script make new folder in start menu and copy files to it

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi
I have this script,
What i'm trying to do is to let the script to make a folder in "Start" menu for all my users and copy files from a temp folder to this new folder.

Dim objFSO, objFolder,ws,
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("C:\Documents and Settings\All Users\Menu Start\New Folder") Then
Set objFolder = objFSO.GetFolder("C:\Documents and Settings\All Users\Menu Start\New Folder")
Else
Set objFolder = objFSO.CreateFolder("C:\Documents and Settings\All Users\Menu Start\New Folder")

Set ws = CreateObject("WScript.Shell")
ws.Exec("xcopy.exe D:\TEMP\ C:\Documents and Settings\All Users\Menu Start\New Folder")
End If

This script makes the "New Folder" ,but no files are copied from "Temp"
Is it also possible to change the icon of the "New Folder".??

5 replies

by robo_dev

for old dos apps like xcopy, you need to enclose any folder or file names in quotes if the names have spaces in them. DOS does not understand spaces

try your xcopy on a commmand line

("xcopy.exe D:\TEMP\ "C:\Documents and Settings\All Users\Menu Start\New Folder"")

by arujammer

I put the quotes, but stil no files are copied

by wancona

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "D:\TEMP\", "C:\Documents and Settings\All Users\Menu Start\New Folder"

in place of...

Set ws = CreateObject("WScript.Shell")
ws.Exec("xcopy.exe D:\TEMP\ C:\Documents and Settings\All Users\Menu Start\New Folder")

by arujammer

This works fine,

*.* were missing.

From now on i will use Copyfile instead of xCopy

This discussion is closed to new replies.