Question

Locked

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

By AruJammer ·
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 \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".??

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

When specifying file or folder names with spaces

by robo_dev In reply to Help with VBS script mak ...

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 \TEMP\ "C:\Documents and Settings\All Users\Menu Start\New Folder"")

Collapse -

No Copy

by AruJammer In reply to When specifying file or f ...

I put the quotes, but stil no files are copied

Collapse -

Try this...

by wancona In reply to Help with VBS script mak ...

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 \TEMP\ C:\Documents and Settings\All Users\Menu Start\New Folder")

Collapse -

Thank you!!!

by AruJammer In reply to Try this...

This works fine,

*.* were missing.

From now on i will use Copyfile instead of xCopy

Back to Software Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums