Batch file

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
Hi

Unsure if this is the right "chat area' for my issue ? But thanks for your help anyhoo.

I have the following 4 files on a usb stick in a folder called 'test data':-
Read me.txt
Expand exe
Startrun.doc
Addsum.pdf.


There are other files in same directory that have the same extensions but only the four above need to be copied to
C:\temp

I have searched the web but I either not find or too complex.

Please can some help.


Thank you.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Run this, navigate to your usb, select files and that's about it

VBA Code:
Sub jec()
 Dim fso As Object, it As Variant
 Set fso = CreateObject("scripting.filesystemobject")
 With Application.FileDialog(3)
   .AllowMultiSelect = True
   If .Show Then
     For Each it In .SelectedItems
        fso.copyfile it, "C:\temp\"
     Next
   End If
 End With
End Sub
 
Upvote 0
Code:
@echo off
set source_folder=C:\Users\pc\Downloads
set target_folder=C:\temp
for %%x in (
             "Read me.txt"
             Expand.exe
             Startrun.doc
             Addsum.pdf
       ) do (
        copy "%source_folder%\%%~x" "%target_folder%"
       )
 
Upvote 0
Run this, navigate to your usb, select files and that's about it

VBA Code:
Sub jec()
 Dim fso As Object, it As Variant
 Set fso = CreateObject("scripting.filesystemobject")
 With Application.FileDialog(3)
   .AllowMultiSelect = True
   If .Show Then
     For Each it In .SelectedItems
        fso.copyfile it, "C:\temp\"
     Next
   End If
 End With
End Sub
much appreciated your help & code thereof. Unfortunately, this is not what I require. But again , thank you.
 
Upvote 0
Code:
@echo off
set source_folder=C:\Users\pc\Downloads
set target_folder=C:\temp
for %%x in (
             "Read me.txt"
             Expand.exe
             Startrun.doc
             Addsum.pdf
       ) do (
        copy "%source_folder%\%%~x" "%target_folder%"
       )
 
Upvote 0

Forum statistics

Threads
1,224,944
Messages
6,181,930
Members
453,073
Latest member
bfrobin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top