• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:41
CET 14:41
KST 22:41
  • 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
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation12Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview [TLMC] Fall/Winter 2025 Ladder Map Rotation TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion What happened to TvZ on Retro? Brood War web app to calculate unit interactions [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Clair Obscur - Expedition 33 Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Artificial Intelligence Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2271 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
Kung Fu Cup
12:00
2025 Monthly #3: Day 4
Classic vs herOLIVE!
RotterdaM776
TKL 398
IndyStarCraft 217
SteadfastSC138
IntoTheiNu 90
Liquipedia
CranKy Ducklings
10:00
Master Swan Open #98
CranKy Ducklings40
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 776
Reynor 438
TKL 398
IndyStarCraft 217
SteadfastSC 138
Rex 120
Railgan 38
StarCraft: Brood War
Britney 37261
Rain 4521
Horang2 1596
Jaedong 1111
Mini 894
Shuttle 497
EffOrt 449
Stork 390
firebathero 351
Last 254
[ Show more ]
BeSt 236
Leta 200
PianO 109
Shinee 84
Hyun 75
Barracks 59
Shine 56
ggaemo 49
JYJ47
Mong 43
sas.Sziky 36
ToSsGirL 28
Movie 26
Hm[arnc] 25
soO 24
zelot 19
Bale 18
Noble 17
sorry 16
LaStScan 13
HiyA 13
Sacsri 8
Dota 2
Gorgc5706
singsing2790
Dendi1191
qojqva1181
XcaliburYe188
febbydoto19
Counter-Strike
oskar134
Other Games
FrodaN4775
B2W.Neo1731
DeMusliM263
Fuzer 223
Lowko217
KnowMe214
Pyrionflax183
Hui .74
Mew2King65
MindelVK15
Organizations
Dota 2
PGL Dota 2 - Main Stream10090
PGL Dota 2 - Secondary Stream2099
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH143
• StrangeGG 26
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 1717
• Ler38
League of Legends
• Stunt1000
Upcoming Events
IPSL
3h 19m
ZZZero vs rasowy
Napoleon vs KameZerg
OSC
5h 19m
BSL 21
6h 19m
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
20h 19m
RSL Revival
20h 19m
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
22h 19m
Cure vs TBD
Reynor vs TBD
WardiTV Korean Royale
22h 19m
BSL 21
1d 6h
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
1d 6h
Dewalt vs WolFix
eOnzErG vs Bonyth
Replay Cast
1d 9h
[ Show More ]
Wardi Open
1d 22h
Monday Night Weeklies
2 days
WardiTV Korean Royale
2 days
BSL: GosuLeague
3 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
BSL: GosuLeague
5 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
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 © 2025 TLnet. All Rights Reserved.