Click here to Skip to main content
15,888,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a batch code that runs a developer command prompt from my regular command prompt but I cann't write to the developer command prompt in batch therefore, I need help. What I want to accomplish is:

1- run CMD
2- From CMD lunch developer command prompt
3- on the developer command prompt change the directory to c:\

That it. How can I get this done in Batch?

What I have tried:

I was trying to see @if exist will work to do this but I am still having issues
Posted
Updated 30-Sep-17 16:05pm
Comments
Patrice T 30-Sep-17 20:35pm    
And you plan to show the batch ?

1 solution

You don't.

There is nothing that holds a reference to the other command prompt in a batch file.

You're only option, IIRC, is to write your commands to another batch file and execute that batch file in the command line of the command to launch your other command prompt.
 
Share this answer
 
Comments
Member 13438927 30-Sep-17 22:06pm    
Sure but how can I do that? I need some guidance for how to create the second command prompt batch file
Dave Kreskowiak 1-Oct-17 13:15pm    
You echo commands out to a file with the redirect operator:
    echo SomeCommand.exe /someParameter >> SomeFile.bat
    echo AnotherCommand /parameter > SomeFile.bat

Notice there are two operators, ">>" and ">". The first one creates a new file or overwrites the file that's there if it already exists. The seceond one appends to an existing file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900