I am writing a very basic VBscript.
It simply asks for input of a date, sets a variable to the date entered (variable name is 'Date') and then runs Xcopy to copy any files changed on or after the date entered. I have managed to set the variable using an InputBox (big deal, I hear everyone shout!) and that works fine.
The problem I am having is with the actual execution of Xcopy. I understand how to use Xcopy in cmd.exe but trying to get my script to run the command does not work.
I think it's something to do with file names / folder names e.g. "Documents and Settings" I know I need to use double quotes etc. when executing this command using WshShell.Run, but I can't seem to get it right. Any ideas please?
Here's the command -
WshShell.Run "Xcopy C:\Documents and Settings\User1\bex*.txt C:\Documents and Settings\User1\backups /D: "&Date
It simply asks for input of a date, sets a variable to the date entered (variable name is 'Date') and then runs Xcopy to copy any files changed on or after the date entered. I have managed to set the variable using an InputBox (big deal, I hear everyone shout!) and that works fine.
The problem I am having is with the actual execution of Xcopy. I understand how to use Xcopy in cmd.exe but trying to get my script to run the command does not work.
I think it's something to do with file names / folder names e.g. "Documents and Settings" I know I need to use double quotes etc. when executing this command using WshShell.Run, but I can't seem to get it right. Any ideas please?
Here's the command -
WshShell.Run "Xcopy C:\Documents and Settings\User1\bex*.txt C:\Documents and Settings\User1\backups /D: "&Date