Solved How do I do a simple .VBS command

May 29, 2018 at 05:58:34
Specs: Windows 7

Im totally baffled after looking on the net at all the options avail.

What im trying to do is set up a .VBS command to move files that start with the name BTP in C:\Documents into S:\Documents .

Trouble is that the file will always start with the letters BTP but will then have different numbers after it.

Any Ideas.


See More: How do I do a simple .VBS command

Report •

May 29, 2018 at 06:22:41
Something that simple is probably better handled by a batch file. Essentially, it is just:

copy C:\Documents\BTP* S:\Documents

Report •

May 29, 2018 at 07:42:27
✔ Best Answer
@echo off
cd "C:\Documents"
for /f "tokens=*" %%a in ('dir/b/OGN ^| find /I "BTP"') do copy /y "%%a" "S:\Documents"

didnt i just answer this a few hours ago in:

I mean it was marked as solved...?

i5-6600K[delid]@4.8GHz/4.4GHz@1.39v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-13-13-28 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1430Mhz core@1.256v/1900MHz BiosModded

message edited by hidde663

Report •

May 29, 2018 at 07:59:00
Yes you did but I had changed mind and just needed it simpler. Thanks tho

Report •

Related Solutions

May 29, 2018 at 11:01:35
Sorry guys and girls,,

Ive just realised what ive done wrong and the original script done was explaining it as i went along DOH. Sorry....

message edited by GDB

Report •

May 30, 2018 at 14:00:41
Ladies and gents

Apologies but ive completely confused myself and can I start a fresh.

I have this script of which does what I want it to do when the file is a file folder.

It looks for all folders that are in C:\Users\g\Documents that start with the letter "B" and moves it to C:\Users\g\Documents\btp but I need to 7zip and password protect folder berore looking for and moving them.

I can 7zip and password protect them no problem but it then turns the folder into a file type as a application.

So what im trying to do is the same thing as below and look in C:\Users\g\Documents for ones that start with the letter "B" but look for APPLICATIONS as file type and not file folder and if poss move them as below.

Is that possible?

@echo off
set source=C:\Users\g\Documents
set dest=C:\Users\g\Documents\btp
set prefix=B

for /f "tokens=*" %%a in ('dir /b "%source%\%prefix%*"') do (echo Moving "%%a"
   xcopy "%source%\%%a\*.*" "%dest%\%%a\" /s /h /k /c /y
   rd "%source%\%%a" /q /s)

echo Done.

Report •

Ask Question