stevemarks59
Technical User
Does anyone know how to write a script that would specifically
copy a file "File.ext" to the clipboard and paste it to this
"My Script.vbs" file?
I do not mean editing the VBScript file. I currently right click
"File.ext" select "Copy" then right click "My Script.vbs" and
select "Paste".
I would like to know if I can do that with a script. I have
included an example of the code used in "My Script.vbs" I have
chosen these file names and directory paths to use as examples
for my post.
I thank you for reading this.
My Script.vbs
copy a file "File.ext" to the clipboard and paste it to this
"My Script.vbs" file?
I do not mean editing the VBScript file. I currently right click
"File.ext" select "Copy" then right click "My Script.vbs" and
select "Paste".
I would like to know if I can do that with a script. I have
included an example of the code used in "My Script.vbs" I have
chosen these file names and directory paths to use as examples
for my post.
I thank you for reading this.
My Script.vbs
Code:
On Error Resume Next
Const OverwriteExisting = True
Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objArgs.Count < 1 Then
WScript.Quit
End If
For I = 0 to objArgs.Count - 1
Arg = objArgs(I)
objFSO.CopyFile Arg, "C:\Desktop\", OverwriteExisting
objFSO.CopyFile Arg, "D:\Desktop\", OverwriteExisting
objFSO.CopyFile Arg, "E:\Desktop\", OverwriteExisting
objFSO.CopyFile Arg, "F:\Desktop\", OverwriteExisting
objFSO.CopyFile Arg, "G:\Desktop\", OverwriteExisting
objFSO.CopyFolder Arg, "C:\Desktop\", OverwriteExisting
objFSO.CopyFolder Arg, "D:\Desktop\", OverwriteExisting
objFSO.CopyFolder Arg, "E:\Desktop\", OverwriteExisting
objFSO.CopyFolder Arg, "F:\Desktop\", OverwriteExisting
objFSO.CopyFolder Arg, "G:\Desktop\", OverwriteExisting
Next
WScript.Quit