Tgeniusclub

Penetration testing and cyber defense

How to create an executable file in command prompt (CMD) like a geek

3 min read
executable file

In this article we are going to discuss how to create an executable file in command prompt, that is, how to create a program (script) that runs in CMD. To be able to do this, you will need to have some knowledge of command prompting, so you should know a few commands in this area.

If you don’t know, no problem; you can use the HELP command to help you with the CMD functions. Then, it will be up to you to continue your research to learn more. Let’s go ? !

Before we go any further, I hope you know what the command prompt is. For those who don’t know the command prompt, is the Windows command line interpreter (not a game console or anything like that). It’s used to execute commands. The console is a piece of software, or rather a way of using the operating system by means of commands called console codes. This term is very familiar to users of Linux systems.

executable file

Well, by default the text is white and there is no transparency but you can customise it. That’s right! This means that you can do everything under the command prompt and even more than you would do with the GUI. But that’s not what we’re going to talk about today, I’ll tell you about that in another article. Let’s move on to what we are interested in here.

As software, here we will use the Windows Notepad, but you can use a text editor that you want like sublime text or vscode. So the first thing to do is to launch your Notepad, then save it in a place you want (and with a name of your choice) but with the extension .cmd.

Look at the location you have chosen, you will see a nice executable file, you can even try by running it

.But in most cases, you will get a message like this:

If you find such a message, it is simply because your script has no command yet. So to correct it you just have to type commands in the file and save it. I use the HELP command that I mentioned above. If all goes well, when you run the little script it will start and close suddenly unless you used a different command than mine.

Well, CMD scripts are read by the computer as text files (line by line), that is to say, that the computer reads line by line your script. It tries to execute the tasks it understands and then continues if there is no more task to complete it closes the script.

If you want your script to stay open, use a command that either asks for information input or launches another program and then the script will be closed automatically only after closing the program it launched. Try with the DISKPART command to launch Diskpart, a partition manager (storage media in general) provided by Windows. Here are the captures of my two screens.

Then, if you execute this script it will show the message “You are watching the course code of my script” because the command echo help to display the message. And the command diskpart helps to run the small program “diskpart”

This is just a small script but you can add commands and even a complete program with the same principle. Thanks for reading this article, especially feel free to put any problems or recommendations in the comments. ??

About The Author

18 thoughts on “How to create an executable file in command prompt (CMD) like a geek

  1. I believe everything published was actually very logical.
    But, what about this? what if you added a little content?
    I am not suggesting your content isn’t solid, however suppose
    you added a post title to maybe grab a person’s attention? I mean How to create an executable
    file in command prompt (CMD) like a geek – Tgeniusclub is
    kinda plain. You ought to peek at Yahoo’s front
    page and see how they create news titles to grab people
    to click. You might add a related video or a picture or two to get readers excited about everything’ve got to say.
    In my opinion, it could bring your posts a little livelier.

  2. Hi there every one, here every one is sharing these knowledge,
    thus it’s pleasant to read this weblog, and I used to visit this weblog every day.

  3. I’m amazed, I must say. Seldom do I encounter a
    blog that’s equally educative and amusing, and without a doubt, you’ve hit the
    nail on the head. The issue is something which
    not enough folks are speaking intelligently about.
    I am very happy I stumbled across this during my
    search for something concerning this.

    My blog: Online Slots

  4. You are so awesome! I don’t think I have read something like that before.
    So great to discover another person with some original
    thoughts on this subject matter. Really..
    many thanks for starting this up. This site is one thing
    that’s needed on the web, someone with some originality!

    Feel free to visit my web blog :: Free Spins

  5. I was curious if you ever thought of changing the page
    layout of your website? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of
    text for only having one or two images. Maybe you could space it
    out better?

    Feel free to visit my web blog; 22bet

  6. Just desire to say your article is as astonishing. The clearness on your submit
    is just excellent and i can think you’re knowledgeable on this
    subject. Fine together with your permission let me
    to grab your RSS feed to keep up to date with approaching
    post. Thank you a million and please carry on the gratifying work.

    Also visit my web page Indian Online Lottery

  7. Thank you for the auspicious writeup. It in fact was
    a amusement account it. Look advanced to far added agreeable from you!
    However, how could we communicate?

    My web-site – pure win

  8. I am not sure the place you are getting your
    information, however good topic. I needs to spend some
    time finding out much more or working out more.
    Thanks for excellent info I used to be in search of this info
    for my mission.

    my site :: Online Blackjack

  9. My brother suggested I might like this website. He was totally right.
    This post actually made my day. You cann’t imagine
    simply how much time I had spent for this info! Thanks!

    My web blog bigbaazi

  10. I’m really enjoying the theme/design of your blog. Do you ever run into any browser
    compatibility issues? A small number of my blog visitors have complained about
    my website not operating correctly in Explorer but looks great in Chrome.
    Do you have any solutions to help fix this problem?

    my web blog :: bettilt

  11. Hello there, I found your web site by means of Google while looking
    for a similar topic, your site got here up, it seems great.
    I’ve bookmarked it in my google bookmarks.
    Hello there, simply was aware of your blog via Google,
    and located that it is really informative.
    I am gonna watch out for brussels. I will be grateful for those who proceed this in future.
    Lots of other people might be benefited from your writing.
    Cheers!
    Stop by my homepage: ปั่นสล็อต

Comments are closed.

Discover more from Tgeniusclub

Subscribe now to keep reading and get access to the full archive.

Continue reading