Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Hunterwould
- Posts: 8
- Joined: 02 Sep 2009 19:24
#1
Post
by Hunterwould » 03 Sep 2009 20:17
I want to enter a command on opening of the command prompt. How would I go about doing so?
Code: Select all
start "%windir%\system32\cmd.exe" {commands}
this doesn't work and I couldn't find it elsewhere.
also as a side not what is the batch source variable? according to the dostips sit it is %0 but when you put in a batch
it returns the source address.
-
avery_larry
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
#2
Post
by avery_larry » 04 Sep 2009 08:41
Hunterwould wrote:I want to enter a command on opening of the command prompt. How would I go about doing so?
Code: Select all
start "%windir%\system32\cmd.exe" {commands}
this doesn't work and I couldn't find it elsewhere.
start /? and cmd /?
will help you a lot. One tricky thing -- if you have more than 1 set of double quotes, then the 1st double quote is taken as the "title" of the start command. For the {commands} part, you'll need the /c OR /k argument to cmd.exe:
Code: Select all
start "The Window Title" cmd /c "c:\path\yourprogram.cmd"
also as a side not what is the batch source variable?
What do you mean by "batch source variable"? %0 is the program that is running (if that makes sense). Example:
At a dos prompt you type in:
c:\> mytest.cmd myargument
Then %1 will be myargument, and %0 will be mytest.cmd
according to the dostips sit it is %0 but when you put in a batch
it returns the source address.