中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 20:49
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Question about this set variable?
Printable Version  1,348 / 7
Floor1 xiaojun Posted 2003-08-16 00:00
银牌会员 Posts 499 Credits 2,202
I have an H partition of over 200 MB dedicated to collecting and storing DOS software. A few days ago when I used a junk-cleaning tool, it deleted all of it for me, more than 100 MB of stuff I had collected! After repeatedly looking into it, I found the reason: for the convenience of DOS, I set set tmp=h:\ in config. Now as long as I point it to the DOS partition, one careless move and it's all over. If I change it to something else like set d=。。。 , then what gets shown is the current directory. (Good thing I didn't point it to ghost :)
How should I set this variable? So that I can still use %TMP% to view my DOS partition? Or more simply, just %D% would be best, less typing; thanks to you.



Floor2 MYS Posted 2003-08-16 00:00
元老会员 Posts 1,637 Credits 5,170 From 广东佛山
TEMP and TMP variables are used to tell the system where to put temporary files.
They are generally set to C:\WINDOWS\TEMP, and some junk-cleaning software may use this variable as the basis for cleaning junk.
Floor3 xiaojun Posted 2003-08-16 00:00
银牌会员 Posts 499 Credits 2,202
On any drive under DOS—typing %tmp% gets me to my DOS drive conveniently. If I don't set it as tmp or temp, but set it as %D% or E, then when I do cd %d% , it shows my current directory. How should I set it properly? AUTOEXEC does have path set to H, but that only runs one of the programs in it. Thanks.
Floor4 hotdog Posted 2003-08-16 00:00
中级用户 Posts 78 Credits 411
Why do you need both temp and tmp
Isn't one enough?
Floor5 xiaojun Posted 2003-08-17 00:00
银牌会员 Posts 499 Credits 2,202
I want that when I type dir %x%, it will list my software directory so I can choose what to run; rather than cd H: and then cd dos, and after finally getting to the h:\dos drive, having to do dir again; how can this be solved?
Floor6 GOTOmsdos Posted 2003-08-20 00:00
铂金会员 Posts 1,827 Credits 5,154
Isn't this simple enough?
I don't quite understand what you're saying. Why did you set tmp=h:\ ? ,(And tmp is shared by Windows and DOS. You also said H is a DOS partition, so aren't C D E as well? Maybe you mean H is FAT16 and supports DOS? But then you also said set tmp=h:\ this tmp is for Windows, isn't it? Your Windows98 isn't FAT16, is it? How can you use a FAT16 file system for temporary files?) I really don't understand what you mean.
To put it simply now, set tmp=h:\dos\temp and then set h=h:\dos, then, dir %h% equals dir h:\dos



























Floor7 xiaojun Posted 2003-08-20 00:00
银牌会员 Posts 499 Credits 2,202
The following is quoted from xiaojun's post on 2003-8-16 21:23:38:
I have an H partition of over 200 MB dedicated to collecting and storing DOS software. A few days ago when I used a junk-cleaning tool, it deleted all of it for me, more than 100 MB of stuff I had collected! After repeatedly looking into it, I found the reason: for the convenience of DOS, I set tmp=h:\ in config. Now as long as I point it to the DOS partition, one careless move and it's all over. If I change it to something else like set d=。。。 then what gets shown is the current directory. (Good thing I didn't point it to ghost :)
            How should I set this variable? So that I can still use %TMP% to view my DOS partition? Or more simply, just %D% would be best, less typing; thanks to you.





My fault for not making it clear: one whole partition just for DOS software installed—H: ; I use set tmp=H: , and in DOS, dir %tmp% will list all the software. I just don't know how to handle it so that it's convenient to view and use, and also won't be deleted as junk.
Floor8 willsort Posted 2003-09-06 00:00
元老会员 Posts 1,512 Credits 4,432
Re xiaojun:

If you don't want it to be deleted as junk, then you must change the value of %tmp% or %temp%! In fact I don't know what convenience setting it to H:\ gives you. Maybe you have a DOS and Windows dual-boot system installed, and want DOS and Windows to share a temporary folder, so you pointed it to H:\, which both systems can access. But this does more harm than good and should be avoided.

"On any drive letter in DOS, typing %tmp% gets me to my DOS drive conveniently. If I don't set it as tmp or temp, but set it as %d% or E, when I do cd %d%, it shows my current directory."
Your problem here is very strange. cd only displays the current path when there are no parameters, so this can only mean that there's something wrong with the environment variable you set or used. Maybe the environment space is full, maybe it's your input. I also tested the same example, and there was no problem at all.

If you want to make viewing and using it convenient, there are simpler ways, such as a batch file. Below is a simple example; it can replace the function of an environment variable.

::dos.bat
@echo off
if "%1"=="" %1 h:\ %2 %3 %4 %4
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023