Question : vbscript copy files to location based on user input

I would like to copy files to a location with VB, but I would like it to ask me a folder name.
EX.  I would like to copy a file to a users desktop folder but I would like it to ask me to type in the user name.  \\server\share\%username%\folder
But I would like it to ask me for the username variable when running.

Thanks

Answer : vbscript copy files to location based on user input

sure, here it goes. I also fixes a mistake on the previous script. Please make sure to finish with and without \ where indicated.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Const OverwriteExisting = True
strUserName = InputBox("Please Enter the username:", "Username")

strSourceFolder = "\\server\share\TestFolder" ' Make sure this path does NOT finish with a backslash \
strSourceFile = "\\server\share\TestFile.txt"
strTargetFolder = "\\server\share\" & strUserName & "\folder\"' Make sure this path finishes with a backslash \

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile strSourceFile , strTargetFolder, OverwriteExisting
objFSO.CopyFolder strSourceFolder , strTargetFolder , OverwriteExisting
Random Solutions  
 
programming4us programming4us