dos command shortcut with a script

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

MatrixX

Thread Starter
Joined
Jul 6, 2001
Messages
189
How do I create a command promp shortcut which automatically types this in the window:
net session<enter>
net file<enter>

Is it even possible?
 
Joined
Dec 25, 2002
Messages
37
open notepad and enter

net session
net file

Do a save as and name the file "whatever.bat". Make sure you change the "Save as type" from Text Documents (*.txt) to "All Files" otherwise, you'll end up with whatever.bat.txt.

Then, you can simply run the file. If you need to modify it later, you can right click it and select Edit.
 

MatrixX

Thread Starter
Joined
Jul 6, 2001
Messages
189
That works but right after I double click the file, it opens for a second, and then closes.
 
Joined
Dec 25, 2002
Messages
37
That's because your commands were executed, and the batch file completed.

If you want the cmd window to stay open, you can add a "pause" line to your batch job. You will then get a prompt to hit any key to continue...

@echo off
net session
net file
pause
 

MatrixX

Thread Starter
Joined
Jul 6, 2001
Messages
189
Thanks, what is this whole thing called. I want to find a website that has more advanced commands that I can play around with.
 
Joined
Oct 28, 2001
Messages
333
thats a batch file. you just use notepad to type in the things you would type into the command prompt. these aren't used as much anymore but they were invaluable during the DOS/Win95 days. they are still pretty handy tools.

http://ericphelps.com/batch/

thats a site with some cool batch files. you can copy and paste them into your notepad and adjust them to fit what you're trying to do.
 
Joined
Dec 25, 2002
Messages
37
Not to be nitpicky, but system admins lives depend upon the use of batch files and scripts. Just because DOS is near death, doesn't mean batch files go with it.

Matrix,
There are books out there how to write and use batch files. It is essentially a very easy to learn scripting tool and can be used to run just about any command line utility or executable there is, and more.

Google to the rescue again...

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=writing+batch+files&btnG=Google+Search
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top