• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:59
CET 16:59
KST 00:59
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation6Weekly 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
[TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t Weekly Cups (Nov 3-9): Clem Conquers in Canada Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
Master Swan Open (Global Bronze-Master 2) Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship
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
BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle Terran 1:35 12 Gas Optimization BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET [ASL20] Grand Finals [Megathread] Daily Proleagues
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
EVE Corporation Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Path of Exile
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 Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! 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: 1192 users

[H]ProgRaming

Blogs > Murlox
Post a Reply
1 2 3 Next All
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 00:50:57
July 17 2009 00:38 GMT
#1
Hi liquidians,

I want to make a .exe that does basic windows functions in this particular order : search file / copy it / create new folder / paste said file into new folder.

I never programmed before, what language / program should i use ?

Thanks in advance


Resistance ain't futile
ghostWriter
Profile Blog Joined January 2009
United States3302 Posts
July 17 2009 00:41 GMT
#2
ProgRamMing.
Sullifam
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 00:42 GMT
#3
Feck i removed the secoNd m...
Resistance ain't futile
Mastermind
Profile Blog Joined April 2008
Canada7096 Posts
July 17 2009 00:48 GMT
#4
Are you serious?
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 00:51 GMT
#5
Yes, edited OP for clarification i hope
Resistance ain't futile
Cambium
Profile Blog Joined June 2004
United States16368 Posts
Last Edited: 2009-07-17 00:52:07
July 17 2009 00:51 GMT
#6
You know you can do this with a batch file right?

If you insist on having an executable, vb/vc++/C# can all do the trick. It's essentially a wrapper around a system call.

Do you know the commands for these tasks?

dir /s/b [file name]
mkdir [new dir name]
cp [dirs found in first step] [new dir name]

There are probably specific libraries for these tasks as well, but I think sys calls will be the easiest.
When you want something, all the universe conspires in helping you to achieve it.
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 01:03 GMT
#7
So i can input the commands you gave me into VB and get a .exe ? (no specific library?)
Resistance ain't futile
illu
Profile Blog Joined December 2008
Canada2531 Posts
July 17 2009 01:05 GMT
#8
If you had absolutely no previous experience in programming and you are not Einstein, it might take you one to two weeks to figure out how to do it properly.

For something easy and accessible, go with Visual Basic.
:]
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 01:20:43
July 17 2009 01:19 GMT
#9
Would this work :

dir /s/b [file1.txt]
mkdir [F:/My Papers]
cp [ ? ] [file1.txt]

I am confused about what to put instead of the "?"
Resistance ain't futile
Tehinf
Profile Joined September 2008
United States192 Posts
July 17 2009 01:32 GMT
#10
i'd use C#
"Good, better, best. Never let it rest until your good is better, and your better is best."
b3h47pte
Profile Blog Joined May 2007
United States1317 Posts
Last Edited: 2009-07-17 02:56:53
July 17 2009 02:55 GMT
#11
On July 17 2009 10:19 Murlox wrote:
Would this work :

dir /s/b [file1.txt]
mkdir [F:/My Papers]
cp [ ? ] [file1.txt]

I am confused about what to put instead of the "?"


he's talking about a batch file.
you put that into Notepad save it as "batch.bat" and run it and it'll do the stuff.

http://www.computerhope.com/batch.htm
That might help you a bit.

If you still want to actually program something, if you're using .NET you can probably use teh Directory class: http://msdn.microsoft.com/en-us/library/system.io.directory.aspx
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
July 17 2009 04:24 GMT
#12
On July 17 2009 10:19 Murlox wrote:
Would this work :

dir /s/b [file1.txt]
mkdir [F:/My Papers]
cp [ ? ] [file1.txt]

I am confused about what to put instead of the "?"


the format is like this:

cp sourcepath destinationpath

sourcepath/destinationpath refer to the location of the file and the name of the file appended to the end. so if you want to copy a file in C:\ called "file1" to F:\ and change the file name to "file2" you would do

cp C:\file1 F:\file2
Murlox
Profile Blog Joined March 2008
France1699 Posts
July 17 2009 10:53 GMT
#13
The dir /s/b [file] command is not working : file cannot be found.

Also, how do I input the path resulted of this search into the cp command ?

cp [variable path] [F:\New Dir\]
Resistance ain't futile
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
July 17 2009 14:36 GMT
#14
search file <- Which search critera?
create new folder <- What name?
copy said file into new folder.
LiquipediaOne eye to kill. Two eyes to live.
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 18:15:17
July 17 2009 18:12 GMT
#15
I'm not sure i get your post, MasterOfChaos.

I want the .bat to search all drives for "file1.txt", whatever computer i use it on.
Once it is located, i want the .bat to copy this file to a new folder, say NewFolder (Name is not important).

That's all.

Main problem is, when I test it, the "dir /s/b [file1.txt]" command fails at finding a file called "file1.txt" placed on my desktop ;

Second problem is that I don't understand how to properly use the "cp" command, since I don't know how to write the first variable, ie. [located path of file1.txt after the search].

Btw, thank you guys for your help so far!
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
Last Edited: 2009-07-17 19:44:36
July 17 2009 19:43 GMT
#16
this code in a .bat file basically does what you want

@ECHO OFF
2>NUL md %2
FOR /F %%f IN ( '"dir \ /s /o /b %1"' ) DO copy /y %%f %2 > NUL

you have to run the batch file with two parameters, 1 is the filename/search pattern which identifies the file you want, 2 is the path of the directory you want created. so, if you put that code in x.bat, you'd have to run: x asdf*.qwr c:\y, and if there is a file matching that pattern it will be put in c:\y (which will be created in every case).

to break the code down a little bit
- %1 and %2 refer to the first and second argument you typed when you ran the batch file
- @ECHO OFF : turns off output (delete to see how %1 and %2 get substituted)
- 2>NUL : suppress error message of md (which you will get if the directory already exists)
- md : dos command for creating a directory
- the FOR loop: for each item found in the paranthesis after IN the operation after DO is executed
- dir \ /s /o /b %1 : this creates a list of all files matching the pattern you gave as first paramter. the \ after dir specifies that the search begins at the root directory. so, if you know that your file is somewhere beneath c:\asd\fgh\ use that instead \
- copy /y %%f %2 : copys all files matching the pattern to %2 (second parameter), the /y switch automatically overwrites existing files. the >NUL surpresses the copy output, if you want to have it delete it

as far as i know you cant enumerate the valid drive letters from a batch file, so if you want to check multiple hard drives, so you might want to change the bat file to

@ECHO OFF
2>NUL md %2
C:
FOR /F %%f IN ( '"dir \ /s /o /b %1"' ) DO copy /y %%f %2 > NUL
D:
FOR /F %%f IN ( '"dir \ /s /o /b %1"' ) DO copy /y %%f %2 > NUL
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 20:38:30
July 17 2009 20:05 GMT
#17
Precious, precious post you made there mate. I'll try this and report. Thanks a lot

Report, i used that:

@ECHO OFF
2>NUL md %c:\test
FOR /F %%f IN ( '"dir \ /s /o /b %moustique.exe"' ) DO copy /y %%f %c:\test

I removed the >NUL since i don't want the original file to be deleted.

This does make a folder c:\test, and replaces it with no warning on every use. However, this stops there, does not duplicate the file moustique.exe (which is located on my desktop) into the folder c:\test
Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
Last Edited: 2009-07-17 21:12:59
July 17 2009 20:57 GMT
#18
On July 18 2009 05:05 Murlox wrote:
Report, i used that:

@ECHO OFF
2>NUL md %c:\test
FOR /F %%f IN ( '"dir \ /s /o /b %moustique.exe"' ) DO copy /y %%f %c:\test

I removed the >NUL since i don't want the original file to be deleted.

This does make a folder c:\test, and replaces it with no warning on every use. However, this stops there, does not duplicate the file moustique.exe (which is located on my desktop) into the folder c:\test


try just these two lines to see all output:

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

the variable names are %1 and %2, so if you want to replace them with constant values, you have to replace %1 and not just the 1. The >NUL stuff after the copy line actually just surpresses the output, but does not stop the auto overwrite. to remove that, you have to remove the /y switch. now, if a moustique.exe was found somewhere on your HD and copied it to c:\test and another moustique.exe is found somewhere else on your HD, you will be prompted to choose an action (i.e. you have to press y or n or sth)

EDIT:
btw, the copy command does indeed make a copy (it's not like in scifi movies where the original is gone after a copy, to achieve that effect you'd have to use "move" instead of "copy"). so, dont be afraid to use your source file
Murlox
Profile Blog Joined March 2008
France1699 Posts
Last Edited: 2009-07-17 21:53:38
July 17 2009 21:51 GMT
#19
It works with this :

@ECHO OFF
md c:\test
copy moustique.exe c:\test

However, the .bat HAS to be in the same directory as the file moustique.exe which is not what I want. Is there a better way to use the COPY command, that is to say not to have to specify the path of the source, only its name?

@yh8c4 : mate, i don't understand your lines, and even after removing the % before 1 and 2 (which i did in the first place), it stills doesnt work to the end : it makes the directory, but doesn't copy the file in it.


Resistance ain't futile
yh8c4
Profile Blog Joined July 2009
108 Posts
July 17 2009 22:12 GMT
#20
seems like i made a mistake with the dir command.. try this

md C:\test
FOR /F %%f IN ( '"dir C:\moustique.exe /s /b"' ) DO copy %%f C:\test
1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
OSC
11:30
Mid Season Playoffs
Krystianer vs PercivalLIVE!
WardiTV1159
TKL 238
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 238
SteadfastSC 92
Rex 83
StarCraft: Brood War
Calm 3285
Rain 2279
Bisu 1720
Hyuk 1637
Horang2 920
Soma 531
Stork 334
Rush 299
Shuttle 188
Backho 101
[ Show more ]
Soulkey 79
sas.Sziky 53
Barracks 53
hero 39
Rock 35
zelot 23
sSak 23
Aegong 19
Killer 16
Terrorterran 11
Dota 2
Gorgc3723
qojqva1929
Dendi1212
BananaSlamJamma147
XcaliburYe96
Super Smash Bros
Mew2King91
Other Games
DeMusliM434
hiko380
Sick363
Hui .313
ceh9207
Fuzer 203
QueenE55
Trikslyr15
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 11
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• 3DClanTV 22
• poizon28 11
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• HerbMon 11
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 2813
• WagamamaTV442
League of Legends
• Nemesis4286
• TFBlade1021
Upcoming Events
Tenacious Turtle Tussle
7h 1m
The PondCast
18h 1m
RSL Revival
18h 1m
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
20h 1m
WardiTV Korean Royale
20h 1m
PiGosaur Monday
1d 9h
RSL Revival
1d 18h
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
1d 20h
CranKy Ducklings
2 days
RSL Revival
2 days
herO vs Gerald
ByuN vs SHIN
[ Show More ]
Kung Fu Cup
2 days
IPSL
3 days
ZZZero vs rasowy
Napoleon vs KameZerg
BSL 21
3 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
3 days
RSL Revival
3 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
3 days
WardiTV Korean Royale
3 days
BSL 21
4 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
4 days
Dewalt vs WolFix
eOnzErG vs Bonyth
Wardi Open
4 days
Monday Night Weeklies
5 days
WardiTV Korean Royale
5 days
The PondCast
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
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
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
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.