Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!tuegate.tue.nl!svin02!eba!ebg.eb.ele.tue.nl!elkassas From: elkassas@ebg.eb.ele.tue.nl (sherif el kassas) Newsgroups: comp.lang.c Subject: Re: DOS Environment Variables Message-ID: <1141@eba.eb.ele.tue.nl> Date: 8 May 91 13:37:04 GMT References: <91125.051531AURPS@ASUACAD.BITNET> <42119@cup.portal.com> Sender: news@eb.ele.tue.nl (The News system) Reply-To: elkassas@eb.ele.tue.nl Organization: Digital Systems, Eindhoven University of Technology, the Netherlands Lines: 61 In article <42119@cup.portal.com>, robc@cup.portal.com (Rob X Cowan) writes: => [stuff deleted] => I forgot to mention that int 2Eh (command.com interface) also has a => way to actually access its own SET command. Can't remember how right now, => but it should be easier than direct access, if your not up to that. => => -Rob => robc@cup.portal.com Well, that's how i'd do it ! any better ideas ? Sherif #include ----8<-------------------------------------- /* * file: test2e.c * demo for changing environment vars ...etc * compile with: * TCC test2e.c * note that u'll need tasm or masm ! */ #include #include char *command = " set t=this is a test \r"; void int2e(char far *command_line) { unsigned seg, ofs; seg = FP_SEG(command_line); ofs = FP_OFF(command_line); asm jmp start asm my_ss dw 00 asm my_sp dw 00 start: asm push bp asm push ds asm mov ax, ss asm mov cs:my_ss, ax asm mov cs:my_sp, sp asm mov si, ofs asm mov ax, seg asm mov ds, ax asm int 2Eh asm cli asm mov sp, cs:my_sp asm mov ax, cs:my_ss asm mov ss, ax asm sti asm pop ds asm pop bp } main() { command[0] = strlen(command)-1; int2e(command); }