• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:47
CET 23:47
KST 07:47
  • 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 Are you ready for ASL 21? Hype VIDEO BGH Auto Balance -> http://bghmmr.eu/ Flash's ASL S21 & Future Plans Announcement
Tourneys
[Megathread] Daily Proleagues ASL Season 21 Qualifiers March 7-8 BWCL Season 64 Announcement [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
No Man's Sky (PS4 and PC) Path of Exile PC Games Sales Thread Nintendo Switch Thread Stormgate/Frost Giant 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
Russo-Ukrainian War Thread US Politics Mega-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: 2404 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
AI Arena Tournament
20:00
RO4 & Finals
PSISTORM Gaming Misc
16:55
FSL TeamLeague: ASH vs ST
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
elazer 250
PiGStarcraft185
UpATreeSC 168
ProTech134
JuggernautJason108
Nathanias 88
StarCraft: Brood War
Sea 4645
NaDa 19
Dota 2
monkeys_forever297
League of Legends
JimRising 339
Counter-Strike
pashabiceps2917
minikerr4
Super Smash Bros
Mew2King82
Heroes of the Storm
Khaldor254
Other Games
summit1g6711
Grubby3998
FrodaN3685
KnowMe449
Trikslyr43
ZombieGrub42
Organizations
StarCraft 2
angryscii 29
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 44
• davetesta39
• musti20045 20
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• blackmanpl 30
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Doublelift5768
Other Games
• imaqtpie1149
• Scarra461
• Shiphtur231
Upcoming Events
Patches Events
13m
Replay Cast
1h 13m
Sparkling Tuna Cup
11h 13m
RSL Revival
11h 13m
Classic vs TriGGeR
Cure vs Cham
WardiTV Winter Champion…
13h 13m
OSC
13h 43m
BSL
21h 13m
Replay Cast
1d 1h
Replay Cast
1d 10h
Monday Night Weeklies
1d 18h
[ Show More ]
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
IEM Atlanta 2026
Asian Champions League 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.