Code:
File.Open("C:\\TSAT\\mapdrive.bat", "", SW_SHOWNORMAL);
File.Open("C:\\TSAT\\mapdrive.bat", "", SW_SHOWNORMAL);
Instead of running a batch read the entire batch as a string and tell apms to use cmd with the string from your batch as arguments.
RunUID = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonA.dat"); RunPWD = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonP.dat"); INT = Input.GetText("Interface1"); IP = Input.GetText("IP"); SUB = Input.GetText("Subnet"); Gate = Input.GetText("Gateway"); qut = Input.GetText("qut"); set = Input.SetText("ALL", "netsh interface ip set address " ..qut ..INT ..qut.. " static " ..IP.." " ..SUB.." " ..Gate..""); --set = Input.SetText("ALL", "netsh interface ip set address " ..INT.." static " ..IP.." " ..SUB.." " ..Gate..""); get = Input.GetText("ALL"); -- Check to see if a specific folder exists. does_exist = Input.GetText(INT); if INT == "" then Dialog.Message("Notice", "Local Area Connection cannot be blank! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\ChangeIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\ChangeIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\ChangeIP.txt"); --Input.SetText("Interface", uSelectedText); TextFile.WriteFromString("AutoPlay\\Docs\\SystemLog.txt", System.GetDate(DATE_FMT_US).." | "..System.GetTime(TIME_FMT_AMPM).." | Change IP was set to static\r\n", true); end if INT == "Interface" then Dialog.Message("Notice", "You cannot use Interface for Local Area Connection! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\ChangeIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\ChangeIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\ChangeIP.txt"); --Input.SetText("Interface", uSelectedText); TextFile.WriteFromString("AutoPlay\\Docs\\SystemLog.txt", System.GetDate(DATE_FMT_US).." | "..System.GetTime(TIME_FMT_AMPM).." | Change IP was set to static\r\n", true); end
RunUID = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonA.dat"); RunPWD = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonP.dat"); INT = Input.GetText("Interface1"); qut = Input.GetText("qut"); set = Input.SetText("ALL", "netsh interface ip show address " ..qut ..INT ..qut.. " >c:\\TSAT\\GetIP.txt"); get = Input.GetText("ALL"); TextFile.WriteFromString("AutoPlay\\Docs\\SystemLog.txt", System.GetDate(DATE_FMT_US).." | "..System.GetTime(TIME_FMT_AMPM).." | Get Other IP of Interfaces was selected\r\n", true); -- Check to see if a specific folder exists. does_exist = Input.GetText(INT); if INT == "" then Dialog.Message("Notice", "Local Area Connection cannot be blank! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\GetIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\GetIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\GetIP.txt"); end if INT == "Interface" then Dialog.Message("Notice", "You cannot use Interface for Local Area Connection! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\GetIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\GetIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\GetIP.txt"); end
args = ' interface ipv4 set address "xxxxx" static 192.168.100.10 255.255.255.0 192.168.100.1 1'; args2 = String.Replace(args, "xxxxx", lanname, false); --Shell.Execute("AutoPlay\\Docs\\netsh.exe", "open", args2, "AutoPlay\\Docs\\", false, true); File.Run(_SystemFolder .. "\\netsh.exe", args2, _SystemFolder, false, true);
File.RunAs("C:\\TSAT\\MapDrive.bat", "", "", SW_SHOWNORMAL, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil);
File.RunAs("C:\\TSAT\\MapDrive.bat", "", "", SW_SHOWNORMAL, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil);
Leave a comment: