• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 11:37
CET 17:37
KST 01:37
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets3$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)15Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1825
StarCraft 2
General
SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets When will we find out if there are more tournament SC2 Spotted on the EWC 2026 list? Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament SC2 AI Tournament 2026 $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) $25,000 Streamerzone StarCraft Pro Series announced WardiTV Winter Cup
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
[ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion A cwal.gg Extension - Easily keep track of anyone Potential ASL qualifier breakthroughs?
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Beyond All Reason Nintendo Switch Thread Awesome Games Done Quick 2026! Mechabellum Stormgate/Frost Giant Megathread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3109 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
WardiTV Invitational
12:00
Group C
GuMiho vs YoungYakovLIVE!
WardiTV1200
TKL 205
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko501
Harstem 295
TKL 205
DivinesiaTV 11
MindelVK 2
BRAT_OK 1
StarCraft: Brood War
Horang2 1346
Shuttle 798
Light 233
Mong 229
actioN 175
hero 175
Snow 136
Rush 133
Hyun 129
Hyuk 123
[ Show more ]
Zeus 77
Barracks 58
Rock 38
JYJ 24
GoRush 22
910 16
Bale 10
Noble 6
Dota 2
qojqva2083
syndereN420
BananaSlamJamma101
Counter-Strike
fl0m2781
byalli402
Foxcn137
adren_tv52
Other Games
singsing1826
Liquid`RaSZi1473
B2W.Neo1269
hiko811
FrodaN689
Hui .334
ArmadaUGS220
QueenE165
oskar89
DeMusliM79
Mew2King53
KnowMe37
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• poizon28 25
• iHatsuTV 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 4
• FirePhoenix2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2275
League of Legends
• TFBlade992
Upcoming Events
The PondCast
17h 23m
OSC
19h 23m
Jumy vs sebesdes
Nicoract vs GgMaChine
ReBellioN vs MaNa
Lemon vs TriGGeR
Gerald vs Cure
Creator vs SHIN
OSC
1d 19h
All Star Teams
2 days
INnoVation vs soO
Serral vs herO
Cure vs Solar
sOs vs Scarlett
Classic vs Clem
Reynor vs Maru
uThermal 2v2 Circuit
2 days
All Star Teams
3 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
3 days
OSC
3 days
Replay Cast
4 days
Wardi Open
4 days
[ Show More ]
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2026-01-13
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
OSC Championship Season 13
Underdog Cup #3
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
SC2 All-Star Inv. 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
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.