• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:56
CEST 08:56
KST 15:56
  • 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
Team TLMC #5 - Finalists & Open Tournaments1[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
StarCraft II 5.0.15 PTR Patch Notes139BSL 2025 Warsaw LAN + Legends Showmatch2Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8
StarCraft 2
General
StarCraft II 5.0.15 PTR Patch Notes #1: Maru - Greatest Players of All Time Team TLMC #5 - Finalists & Open Tournaments Team Liquid Map Contest #21 - Presented by Monster Energy Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues
Tourneys
Stellar Fest KSL Week 80 StarCraft Evolution League (SC Evo Biweekly) RSL: Revival, a new crowdfunded tournament series SC2's Safe House 2 - October 18 & 19
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
ASL20 General Discussion BW General Discussion Diplomacy, Cosmonarchy Edition Soulkey on ASL S20 ASL TICKET LIVE help! :D
Tourneys
[ASL20] Ro16 Group D BSL 2025 Warsaw LAN + Legends Showmatch [ASL20] Ro16 Group C Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Borderlands 3 Nintendo Switch Thread General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The Big Programming Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
Too Many LANs? Tournament Ov…
TrAiDoS
i'm really bored guys
Peanutsc
I <=> 9
KrillinFromwales
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1791 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
Korean StarCraft League
03:00
Week 80
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft703
Nina 189
StarCraft: Brood War
hero 688
PianO 284
Nal_rA 134
sorry 69
Noble 34
Free 32
JulyZerg 21
Aegong 20
Bale 10
Dota 2
NeuroSwarm144
League of Legends
JimRising 592
Counter-Strike
Stewie2K698
semphis_39
Super Smash Bros
Westballz22
Other Games
summit1g4119
C9.Mang0252
Maynarde178
Trikslyr40
ViBE37
Organizations
Other Games
gamesdonequick754
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH398
• LUISG 9
• Adnapsc2 6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos602
• Stunt556
Upcoming Events
BSL Open LAN 2025 - War…
1h 4m
RSL Revival
3h 4m
Reynor vs Cure
TBD vs Zoun
OSC
14h 4m
BSL Open LAN 2025 - War…
1d 1h
RSL Revival
1d 3h
Classic vs TBD
WardiTV Invitational
1d 4h
Online Event
1d 9h
Wardi Open
2 days
Monday Night Weeklies
2 days
Sparkling Tuna Cup
3 days
[ Show More ]
LiuLi Cup
4 days
The PondCast
5 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
RSL Revival: Season 2
Maestros of the Game
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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.