Hi, I'm running a batch file from lisp to map a drive to a server (net use N: \\server\share). This works fine, but I cannot be sure whether or not it has actually worked and all's OK to continue with my lisp as I'm unsure where or how the results of this batch file command are stored. I could of course search for a file I've previously planted there but that seems messy. Could anyone let me know how to establish the success or failure of this command ? Thanks Peter
If you are just trying to see if the drive gets mapped, could you do something like this? (findfile "N:\\.") Tim
Thanks Tim, The N: drive is being constantly remapped to different servers as I am running a routine that's checking for the appearance of new files on many servers. the bat file actually attempts to remove the current mapping before applying the new one, and this is where I seem to have problems as, if the drive wont disconnect (net use N: /delete /y), the new server won't remap to the new server, and the trouble starts. Using (findfile "N:\\") will therefore always return a positive result. Since posting this I've found I can create an environment variable by using "set myvar=net use n: \\server\share" but I'm still unsure how to get the value of 'myvar' back into the lisp environment. Cheers peter
(getenv myvar) seems to always retun nil. I've used "set myvar=net use n:\\server\share", and then (in a cmd shell) typed %myvar% and it returns the string "The command completed successfully" which is great, but I don't know how to get this value back into my lisp routine. Thanks Peter
Interesting. I haven't had occasion to do anything like this, but would have thought setenv and getenv would work. I can use those within an Acad session to set and retrieve values. I'm a little rusty on DOS, but if I type "set testvar=foo" in a cmd shell, then type "echo %testvar%" it returns "foo." If I type "set testvar" it returns "testvar=foo." I believe the %variable% syntax only applies in certain contexts, such as in batch files.
It seems that using 'set' in a batch file doesn't actually create an 'environment variable', (doesn't appear in user or system variable list) and therefore cannot be recalled using (getenv myvar) but it does create some type of variable as it can be recalled by surrounding the variable name with percentage symbols in a shell window. I'm still confused but Thanks for all the input.. Peter
I think you are incorrect. In autoexec.bat - place SET TEMP=C:\WINDOWS\TEMP (restart machine so it executes autoexec.bat) In Autocad: Command: (getenv "temp") "C:\\WINDOWS\\TEMP" Bob