Lee Bussy 0 Posted August 29, 2011 I received some help getting my environment set up in .?do=embed' frameborder='0' data-embedContent> I'm still having issues and not really sure why. I figured I'd post the whole issue and see if someone can tell me what I am doing wrong.Here is the batch file I am trying to emulate:@echo off REM See if T: is mapped to \\server\volume If exist t:\program.exe goto starthere REM Unmap T: and re-map to \\server\volume %SystemRoot%\System32\net use t: /delete > NUL %SystemRoot%\System32\net use t: \\server\volume > NUL :starthere REM Map a printer to LPT2 (change as needed) > NUL net use lpt2 /delete > NUL net use lpt2: \\printserver\printer > NUL t: program.exe > NULAs I posted in the the batch file requires that the folowing is set up in C:\WINDOWS\system32\Config.NT:dos=high, umb files=125 device=%SystemRoot%\system32\himem.sys device=%SystemRoot%\system32\emm386.exe NOEMS(Yes this is a very old program)I am not worrying about the printer right now, I need to make that more generic, but here's the issue I am having: The "system" needs to be at the correct drive (in this case T:) before running the program. I have tried the working directory options but so far no luck. Here is where I am:$sShare = "\\server\share" $sExecutable = "program.exe" $sVolume = DriveMapAdd ("*", $sShare, 8) If @error Then MsgBox (0, "Error", "Error mapping drive to " & $sShare) Else MsgBox (0, "Success", "Mapped drive " & $sVolume & ": to " & $sShare) EndIf EnvSet ("dos", "high, umb") EnvSet ("files", "125") EnvSet ("device", "himem.sys") EnvSet ("device", "emm386.exe NOEMS") EnvUpdate() MsgBox (0,"Debug","Executing: " & @ComSpec & " /c " & $sVolume & ":/" & $sExecutable) RunWait(@ComSpec & " /c " & $sVolume & ":/" & $sExecutable, $sVolume & ":/",@SW_SHOW) DriveMapDel ($sVolume) MsgBox (0, "Removal", "Un-mapped drive " & $sVolume & ": from " & $sShare) ExitI believe that the executable is not running in it's own directory. When I type the "debug" line into a command prompt I get errors form the program telling me it can't find it's configuration files (not working in the right directory).This is a long post for what is very likely a simple issue, but I wanted to give enough information so I don't have to keep coming back to the well. Thanks in advance for any assistance. Share this post Link to post Share on other sites
SmOke_N 211 Posted August 29, 2011 If you're sure that's the issue, then use FileChangeDir() before the Run* call, and back again to @ScriptDir if necessary after. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
Lee Bussy 0 Posted August 29, 2011 Well that wasn't it (thank you for replying) but it did send me to find the right answer. The line: RunWait(@ComSpec & " /c " & $sVolume & ":/" & $sExecutable, $sVolume & ":/",@SW_SHOW)is what blew me up. Apparently the volume returned by DriveMapAdd has a trailing colon so the correct line was: RunWait(@ComSpec & " /c " & $sVolume & "/" & $sExecutable, $sVolume & "/",@SW_SHOW)... and that worked. Damned glasses! Share this post Link to post Share on other sites