• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:40
CET 19:40
KST 03:40
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
ByuL: The Forgotten Master of ZvT29Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Team Liquid Map Contest - Preparation Notice6Weekly Cups (Feb 23-Mar 1): herO doubles, 2v2 bonanza1Weekly Cups (Feb 16-22): MaxPax doubles0Weekly Cups (Feb 9-15): herO doubles up2ACS replaced by "ASL Season Open" - Starts 21/0258
StarCraft 2
General
Vitality disbanding their sc2-team How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Team Liquid Map Contest - Preparation Notice ByuL: The Forgotten Master of ZvT Nexon's StarCraft game could be FPS, led by UMS maker
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament $5,000 WardiTV Winter Championship 2026 Sea Duckling Open (Global, Bronze-Diamond) PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 515 Together Forever Mutation # 514 Ulnar New Year Mutation # 513 Attrition Warfare
Brood War
General
battle.net problems BSL 22 Map Contest — Submissions OPEN to March 10 BGH Auto Balance -> http://bghmmr.eu/ Flash's ASL S21 & Future Plans Announcement Gypsy to Korea
Tourneys
ASL Season 21 Qualifiers March 7-8 BWCL Season 64 Announcement [Megathread] Daily Proleagues [BSL22] Open Qualifier #1 - Sunday 21:00 CET
Strategy
Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Simple Questions, Simple Answers Zealot bombing is no longer popular?
Other Games
General Games
Path of Exile PC Games Sales Thread Nintendo Switch Thread Stormgate/Frost Giant Megathread Battle Aces/David Kim RTS Megathread
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Mexico's Drug War Things Aren’t Peaceful in Palestine YouTube Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Gaming-Related Deaths
TrAiDoS
ONE GREAT AMERICAN MARINE…
XenOsky
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2193 users

[H]ProgRaming - Page 2

Blogs > Murlox
Post a Reply
Prev 1 2 3 Next All
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 22:20 GMT
#21
I don't get it...

Your code does not work, neither do my old very simple "copy moustique.exe c:\test" anymore... and i rebooted.

Wtf?
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 22:30 GMT
#22
i just copy-pasted what i wrote in my last post, created a moustique.exe on my desktop and ran it. i have now a c:\test with moustique.exe in it, so it does work.

it just takes ages to run if you have all your stuff in c:\ (since the copy only starts when dir has finally looked into every folder in C:\ for that file (no way to stop the search after the first found, afaik)).

its a whole lot faster if you know that it's for example somewhere in C:\users (which is probably where your desktop folder is), so try

md C:\test
FOR /F %%f IN ( '"dir C:\Users\moustique.exe /s /b"' ) DO copy %%f C:\test
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 22:45:50
July 17 2009 22:43 GMT
#23
It doesnt work for me.

But even a very simple COPY command does not work anymore unless i specify the exact path, although it did work with no path at all minutes ago, so i suspect the .bat files to be somehow inneffective now?

Thank you anyway, i will look why those .bat refuse to work any longer and will then try your code.

Edit :

I mean, even

md c:\test

doesn't work!
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 22:50 GMT
#24
sounds like bat file you edit is not the one you run
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 22:58:01
July 17 2009 22:53 GMT
#25
Hah, could be although i don't think i am that tired, getting one to work now, testing your code.

Ok, so :

md C:\test
FOR /F %%f IN ( '"dir C:\Users\moustique.exe /s /b"' ) DO copy %%f C:\test


does create c:\test, but does not copy moustique.exe in it for me.

On the other hand,

md c:\test
copy moustique.exe c:\test


does create c:\test and copies moustique.exe in it
Problem here, the .bat has to be in the same repertory as moustique.exe to work
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 23:06 GMT
#26
in which folder is your desktop?
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 23:12:19
July 17 2009 23:08 GMT
#27
C:\Documents and Settings\Murlox\Bureau

Edit :

even with

md C:\test
FOR /F %%f IN ( '"dir C:\Documents and Settings\Murlox\Bureau\moustique.exe /s /b"' ) DO copy %%f C:\test

It still does not do the trick. Won't copy.


Moreover, this is not really the direction i want to go, since what I really want is not to input any path at all, (.bat should find the file itself)
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 23:28 GMT
#28
the problem are the spaces in the foldername, and i don't think you can handle those within the batch file, so if you can't be sure the file you're looking for is in a path which doesnt contain a space, you're out of luck.
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 23:30 GMT
#29
i've read that the spaces in names can be handled with " " in .bats
Resistance ain't futile
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
July 17 2009 23:32 GMT
#30
Isn't everyone missing the point? He wants to learn programming simple windows programs. Start out with Visual Basic, hands down the easiest platform to start on for this. You probably don't want to go for win32 with C++ or anything similar without having some serious dedication.
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 23:57:52
July 17 2009 23:46 GMT
#31
Hei da,

We are right on the point mate :-)

I think basic dos commands can do my job, well i hope so. If i manage to get this DIR or COPY or XCOPY command to look for my file without feeding them the path of it...

@yh8c4 :

As I understand it,

/b after DIR is for clarification (no summary)

/s after DIR is to display files in specified directory and all subdirectories. I think this does not mean every subdirectories of the drive though, but just the subdirectories of specified directory... Which is not enough in my case ;7

May be DIR is not the proper command?


dir \ moustique.exe /s finds it !
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 23:56 GMT
#32
ok. this should be it..

md C:\test
FOR /F "delims=" %%f IN ( '"\moustique.exe /b /s"' ) DO copy "%%f" C:\test

faster version with a small hint to your desktop...

md C:\test
FOR /F "delims=" %%f IN ( '"C:\"Documents and Settings"\moustique.exe /b /s"' ) DO copy "%%f" C:\test

better copy-paste, this has some more "s...
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-18 00:03:09
July 17 2009 23:58 GMT
#33
testing ^^

Neither your versions work...
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 18 2009 00:01 GMT
#34
On July 18 2009 08:46 Murlox wrote:
Hei da,

We are right on the point mate :-)

I think basic dos commands can do my job, well i hope so. If i manage to get this DIR or COPY or XCOPY command to look for my file without feeding them the path of it...

@yh8c4 :

As I understand it,

/b after DIR is for clarification (no summary)

/s after DIR is to display files in specified directory and all subdirectories. I think this does not mean every subdirectories of the drive though, but just the subdirectories of specified directory... Which is not enough in my case ;7

May be DIR is not the proper command?


/b outputs the complete path to the file + filename and no this date, size etc crap, we just need the path + name to feed it to the copy command

/s if the specified directory is \ then /s means checking each and every directory on that drive

the dir command isnt optimal for your problem (since you probably want the search to end once the file has been located), but there's nothing which gets the job done (that is providing the source paramter for the copy command)
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 18 2009 00:06 GMT
#35
Btw, how do you use the result provided by the DIR command with the COPY command ?

Because DIR \ moustique.exe /s finds the file ; how can use this result as a source for COPY ?
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 18 2009 00:17 GMT
#36
i created a c:\c\documents and settings\murlox\bureau path, put a moustique.exe there, and ran the bat file. result:

[image loading]


On July 18 2009 09:06 Murlox wrote:
Btw, how do you use the result provided by the DIR command with the COPY command ?

Because DIR \ moustique.exe /s finds the file ; how can use this result as a source for COPY ?


thats what the FOR loop does
the stuff in the parantheses after IN is a set of dir results. you basically say: let %%f be a member of this set, then for each member in that set do copy %%f c:\test. you know what i mean? for each item in the IN ( ... ) set copy is called once, and %%f gets substituted with that item.
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 18 2009 00:25 GMT
#37
IN (...) locates the item, this result (or path?) is put in %%f, then COPY uses %%F as its source ?

And FOR loops this whole system. Am i getting it right?
Resistance ain't futile
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 18 2009 00:31 GMT
#38
Am going to check some more and then to sleep.

Thank you very much for you help yh8c4, was a pleasure
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 18 2009 00:46 GMT
#39
i hope this explains what happens:

[image loading]


i put some files in c:\tmp\x (printed with /b /s)
then i print out the content of x.bat (with the type command)

then i run x.bat, and you can see that copy is run 4 times, because the call for dir *.txt /b /s yielded 4 results, which are the contents inside the IN ( ). each time copy is run, it is run with a different source parameter, because each time the %%f gets substituted with a different item from the IN ( ) set.

i'm 100% sure, that
md C:\test
FOR /F "delims=" %%f IN ( '"\moustique.exe /b /s"' ) DO copy "%%f" C:\test

works, just run it and make a screenshot

yh8c4
Profile Blog Joined July 2009
108 Posts
July 18 2009 01:00 GMT
#40
wow, seems like i never even tried my 100% solution... it was missing the dir command!

md C:\test
FOR /F "delims=" %%f IN ( '"dir \moustique.exe /b /s"' ) DO copy "%%f" C:\test
Prev 1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
PSISTORM Gaming Misc
16:55
FSL TeamLeague: ASH vs ST
Freeedom31
Liquipedia
WardiTV Winter Champion…
12:00
Playoffs
Classic vs SolarLIVE!
Bunny vs Zoun
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Liquid`TLO 558
mouzHeroMarine 153
elazer 125
JuggernautJason77
Rex 70
BRAT_OK 48
MindelVK 24
EmSc Tv 19
StarCraft: Brood War
Sea 10130
Rock 33
nyoken 31
NaDa 31
Dota 2
Gorgc5004
qojqva1728
monkeys_forever155
BananaSlamJamma115
Counter-Strike
fl0m3377
Super Smash Bros
Mew2King83
Heroes of the Storm
Khaldor578
Liquid`Hasu404
Other Games
gofns39750
tarik_tv13056
FrodaN2691
Grubby2286
summit1g1901
Mlord431
Beastyqt389
KnowMe140
QueenE56
Organizations
Dota 2
PGL Dota 2 - Main Stream7671
Other Games
BasetradeTV135
StarCraft 2
EmSc Tv 19
EmSc2Tv 19
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• printf 34
• Adnapsc2 14
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• blackmanpl 35
• FirePhoenix3
• Michael_bg 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Nemesis4942
• Shiphtur326
Other Games
• imaqtpie675
Upcoming Events
AI Arena Tournament
1h 20m
Patches Events
4h 20m
Replay Cast
5h 20m
Sparkling Tuna Cup
15h 20m
RSL Revival
15h 20m
Classic vs TriGGeR
Cure vs Cham
WardiTV Winter Champion…
17h 20m
OSC
17h 50m
BSL
1d 1h
Replay Cast
1d 5h
Replay Cast
1d 14h
[ Show More ]
Monday Night Weeklies
1d 22h
OSC
2 days
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
Replay Cast
6 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Proleague 2026-03-05
PiG Sty Festival 7.0
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
Spring Cup 2026
ASL Season 21: Qualifier #1
RSL Revival: Season 4
WardiTV Winter 2026
Nations Cup 2026
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

ASL Season 21: Qualifier #2
ASL Season 21
Acropolis #4 - TS6
Acropolis #4
IPSL Spring 2026
CSLAN 4
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
NationLESS Cup
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.