• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 15:13
CET 21:13
KST 05:13
  • 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 - Playoffs Preview0RSL 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
Community News
RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge1[TLMC] Fall/Winter 2025 Ladder Map Rotation14Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA12
StarCraft 2
General
RSL Season 3: RO16 results & RO8 bracket SC: Evo Complete - Ranked Ladder OPEN ALPHA RSL Season 3 - Playoffs Preview Mech is the composition that needs teleportation t GM / Master map hacker and general hacking and cheating thread
Tourneys
RSL Revival: Season 3 $5,000+ WardiTV 2025 Championship StarCraft Evolution League (SC Evo Biweekly) Constellation Cup - Main Event - Stellar Fest 2025 RSL Offline Finals Dates + Ticket Sales!
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened
Brood War
General
soO on: FanTaSy's Potential Return to StarCraft BGH Auto Balance -> http://bghmmr.eu/ A cwal.gg Extension - Easily keep track of anyone Data analysis on 70 million replays [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Tie Breaker - Group A - Sat 21:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] GosuLeague T1 Ro16 - Tue & Thu 22:00 CET
Strategy
Game Theory for Starcraft Current Meta How to stay on top of macro? PvZ map balance
Other Games
General Games
Clair Obscur - Expedition 33 Stormgate/Frost Giant Megathread EVE Corporation Path of Exile [Game] Osu!
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
Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread The Games Industry And ATVI Things Aren’t Peaceful in Palestine About SC2SEA.COM
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread Korean Music Discussion
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
TL Community
The Automated Ban List
Blogs
The Health Impact of Joining…
TrAiDoS
Dyadica Evangelium — Chapt…
Hildegard
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1921 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
BSL 21
20:00
RO16 TieBreaker - Group A
TerrOr vs Aeternum
HBO vs Kyrie
ZZZero.O99
LiquipediaDiscussion
OSC
17:00
Masters Cup #150: Group C
davetesta174
Liquipedia
IPSL
17:00
Ro16 Group B
Julia vs Artosis
JDConan vs DragOn
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
White-Ra 360
IndyStarCraft 193
Nathanias 80
MindelVK 32
Vindicta 10
StarCraft: Brood War
Britney 27492
Dewaltoss 103
ZZZero.O 78
Rock 64
Shine 28
Noble 19
NaDa 10
League of Legends
rGuardiaN115
Counter-Strike
ScreaM1463
fl0m1244
adren_tv84
Heroes of the Storm
Liquid`Hasu366
Khaldor274
Other Games
Grubby3527
qojqva2269
FrodaN1429
B2W.Neo739
Mlord691
Beastyqt629
crisheroes413
TKL 152
Hui .124
KnowMe97
Trikslyr70
Organizations
Dota 2
PGL Dota 2 - Main Stream11982
Other Games
gamesdonequick1094
EGCTV1056
BasetradeTV18
StarCraft: Brood War
lovetv 7
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• printf 93
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• Airneanach177
• 80smullet 11
• Pr0nogo 4
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 5746
• Ler70
• Noizen41
League of Legends
• Nemesis4585
Other Games
• imaqtpie1224
• Shiphtur316
Upcoming Events
RSL Revival
11h 17m
Classic vs SHIN
Maru vs TBD
herO vs TBD
Wardi Open
17h 47m
IPSL
23h 47m
StRyKeR vs OldBoy
Sziky vs Tarson
BSL 21
23h 47m
StRyKeR vs Artosis
OyAji vs KameZerg
OSC
1d 2h
OSC
1d 12h
Monday Night Weeklies
1d 20h
OSC
2 days
Wardi Open
2 days
Replay Cast
3 days
[ Show More ]
Wardi Open
3 days
Tenacious Turtle Tussle
4 days
The PondCast
4 days
Replay Cast
5 days
LAN Event
5 days
Replay Cast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-11-16
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

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.