Q closes edlin without save, E - with save.
You can use the ; between multiple commands to execute all commands at once.
But I think it's better to look for something smarter than edlin... ;)
Main Topics
Browse All TopicsHi All,
Can anyone tell me the command to automatically open and close edlin DOS editor in a DOS batch file?
Regards,
Pranjal
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry I think you did not get what I want actually.
I want to open the editor automatically using a DOS command in a batch file and again close it automatically without using the file menu exit command and then go to the next command in the batch file for execution.
For e.g my batch file is a.bat and in this I have the following commands
echo "How are you?
edit
dir /s
So here above the editor will open with the "edit" command but it is not closing automatically....!
Hope you understand my problem.
Regards,
Pranjal
Still it is not solving my purpose.
What I want actually is that my program should use short names of dos instead of long names with spaces in between for e.g if my directory name is "HCMG Source" then if I do CD "HCMG Source" and then just open editor with edit command and close then after that it shows me the directory name as C:\HCMGSO~1> and I want this short name to be used in my further commands instead of the log name "HCMG Source".
Can anyone tell me a solution to this?
Regards,
Pranjal
1) create a file as follows:
a) enter the following command in DOS
COPY CON qy.txt
b) enter a letter 'q' as in the following:
q
c) then, enter a letter 'y' as in the following:
y
d) now for the tircky bit... hold down the CTRL key and type a 'z' while doing so as in the following:
^Z
e) finally, press the ENTER (or carriage return) key
you will see the familiar "1 file(s) copied." message
2) Now enter the following command to shorten your prompt:
EDLIN qy.txt<qy.txt>nul
All,
This is because edit.com and edlin.exe are MS-DOS, not Windows, executables. Of course, DOS does not support long filenames, so the DOS emulator in Windows sets the current directory to its short path before executing the DOS program. The short answer is that there is no workaround for this because you are running MS-DOS executables, not Windows executables. (Evidence for this is that edit.com and edlin.exe are not present in 64-bit Windows versions, because 64-bit Windows has dropped MS-DOS emulation.)
The solution is to use Windows programs, not MS-DOS programs.
Bill
dragon-it
I think the asker wants to know how he could start Edlin or Edit and then exit immediately. The effect of running either of these legacy applications in XP, 2K and NT causes the system prompt to revert to SFN format. My interpretation is that he wants more command line room.
However, there's also a chance he might want to force say, Edit to to view filenames in 8.3 format when in the Open, Save or Save As dialog boxes - in which case there is the '/S' command line option which forces Edit to use SFN format.
By the way, your use of pwd=%cd% could have been written as:
PUSHD %CD
:
POPD
Furthermore, in your last post, %%~a merely returns the value of %CD% which could have been gotten with the following stand-alone command:
CD
It'll be interesting to see which way this question swings....
I used %%~sa which got the short path for of the variable, I.e. the way to get the path changed into 8.3 format without using a DOS legacy app which might not be present on a newer OS (or behaviour may be diferent).
Not entirely clear what is wanted either mind.. but if you do want to just change to 8.3 dir format would suggest using native windows command rather than side effect of legacy app.
Steve
Business Accounts
Answer for Membership
by: ryan_westPosted on 2009-08-08 at 09:45:13ID: 25050832
To enter the EDLIN environment you type the word EDLIN followed by the name of
the file you wish to create or edit:
C:\>EDLIN CONFIG.SYS
An asterisk will appear:
*
You will type the letter I and press enter to go into the Insert mode:
*I
The computer responds with:
1:*
This 1 refers to line 1 of the CONFIG.SYS you are now creating. You will now
just type each line and press enter. When finished you will press the <F6>
key to return to the furthest left asterisk:
1:*FILES = 20
2:*BUFFERS = 15
3:<F6>
*
At this asterisk you will now type E and press enter to End the process and
save what you just created:
*E
C:\>