• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:33
CEST 17:33
KST 00:33
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL62Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event21Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays FEL Cracov 2025 (July 27) - $8000 live event Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Player “Jedi” cheat on CSL SC uni coach streams logging into betting site Flash Announces Hiatus From ASL Practice Partners (Official) ASL20 Preliminary Maps
Tourneys
CSL Xiamen International Invitational [BSL20] Grand Finals - Sunday 20:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread What do you want from future RTS games? 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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Summer Games Done Quick 2025! Trading/Investing Thread Things Aren’t Peaceful in Palestine
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 632 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
FEL
12:00
Cracov 2025: Qualifier #2
CranKy Ducklings681
IndyStarCraft 331
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 344
IndyStarCraft 342
Hui .209
StarCraft: Brood War
Calm 4761
Rain 2555
Shuttle 1433
Horang2 1336
EffOrt 956
Bisu 925
Jaedong 739
Hyuk 377
Mini 376
Stork 328
[ Show more ]
TY 297
GuemChi 197
Soma 131
ToSsGirL 121
hero 121
Barracks 96
Hyun 83
Sacsri 78
PianO 55
GoRush 47
Sea.KH 39
Free 28
Terrorterran 17
HiyA 9
ivOry 4
Stormgate
TKL 310
Dota 2
qojqva3595
Fuzer 352
canceldota274
LuMiX1
League of Legends
singsing2833
Counter-Strike
byalli269
edward53
Super Smash Bros
Chillindude54
Heroes of the Storm
Khaldor648
Liquid`Hasu424
Other Games
Gorgc3321
B2W.Neo1540
FrodaN1118
ArmadaUGS92
KnowMe67
Organizations
Other Games
EGCTV1265
StarCraft: Brood War
Kim Chul Min (afreeca) 10
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• StrangeGG 74
• Adnapsc2 11
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 3662
• WagamamaTV781
• Ler138
Upcoming Events
BSL: ProLeague
2h 27m
Dewalt vs Bonyth
Replay Cast
1d 8h
Sparkling Tuna Cup
1d 18h
WardiTV European League
2 days
The PondCast
2 days
Replay Cast
3 days
RSL Revival
3 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
4 days
RSL Revival
4 days
Classic vs Cure
FEL
5 days
[ Show More ]
RSL Revival
5 days
FEL
5 days
FEL
6 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
FEL
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
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.