Huntknife 0 Posted February 27, 2020 Could someone help me to change Bat Code to Autoit code? Becouse i know that you cant change bat file to Autoit exe until you change the code language right? expandcollapse popup@echo off :menu ECHO. ECHO .................... ECHO Spausti 1 - Change ip ECHO Spausti 2 - Start ping ECHO Spausti 3 - Open google chrome ECHO .................... ECHO. echo= IP Change: %IP% echo. CHOICE /C:123 IF ERRORLEVEL 1 SET M=1 IF ERRORLEVEL 2 SET M=2 IF ERRORLEVEL 3 SET M=3 IF %M%==1 GOTO start IF %M%==2 GOTO ping IF %M%==3 GOTO chrome :start echo. set /p IP= Change IP= netsh interface ipv4 set address name="Eternetas" static %IP% 255.255.255.0 echo. cls goto menu :ping echo. set /p Ping= Ping ip= echo. Ping %Ping% -t pause cls goto menu :chrome start "" www.google.com cls goto menu The main question can Autoit do these things? Share this post Link to post Share on other sites
Subz 684 Posted February 27, 2020 AutoIt can do this, you can call the commands via Run i.e. Example (untested) Local $sIP = "192.168.1.1" RunWait(@Comspec & ' /c netsh interface ipv4 set address name="Eternetas" static ' & $sIP & ' 255.255.255.0') Share this post Link to post Share on other sites
Musashi 305 Posted February 27, 2020 (edited) 14 minutes ago, Huntknife said: The main question can Autoit do these things? You can also run the Batchfile from AutoIt (name.bat or name.cmd) : RunWait(@ComSpec & " /C " & "name.bat", "", @SW_SHOW) Change /C to /K to see, if an error is displayed in the CMD window. Edited February 27, 2020 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Share this post Link to post Share on other sites
Huntknife 0 Posted February 27, 2020 Strange thing, i can load cmd file without error. But only thing that works is IP change, but not all three functions If i press 2 its still runs first function. Maybe have some ideas? Share this post Link to post Share on other sites
Musashi 305 Posted February 27, 2020 45 minutes ago, Huntknife said: If i press 2 its still runs first function. Maybe have some ideas? This CMD jumps at least to the correct goto positions. You have to test if the respective commands are correct there. expandcollapse popup@echo off :menu echo. echo .......................... echo Spausti 1 - Change ip echo Spausti 2 - Start ping echo Spausti 3 - Open google chrome echo Spausti [ESC] - Quit echo .......................... echo. echo= IP Change: %IP% echo. set Modus=0 set /p modus="Enter Selection : " if %modus%==1 goto start if %modus%==2 goto ping if %modus%==3 goto chrome goto end :start echo. set /p IP= Change IP= netsh interface ipv4 set address name="Eternetas" static %IP% 255.255.255.0 echo. cls goto menu :ping echo. set /p Ping= Ping ip= echo. Ping %Ping% -t pause cls goto menu :chrome start "" www.google.com cls goto menu end: echo Script terminated pause "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Share this post Link to post Share on other sites
Huntknife 0 Posted February 27, 2020 That worked well, thank you for help guys. Share this post Link to post Share on other sites
Nine 921 Posted February 27, 2020 Instead of using this prehistoric DOS approach, I would recommend that you create a simple AutoIt GUI that can provide a more robust, secure interface. It only takes a few minutes, you could add some input verification and automate pretty much all you want within your script without relying to external program. 2 Musashi and seadoggie01 reacted to this Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Musashi 305 Posted February 27, 2020 1 hour ago, Nine said: Instead of using this prehistoric DOS approach, I would recommend that you create a simple AutoIt GUI that can provide a more robust, secure interface. It only takes a few minutes, you could add some input verification and automate pretty much all you want within your script without relying to external program. Note: I only corrected the CMD, because it was part of the user question . In general, I agree with you 100% that an AutoIt-GUI is definitely the better and more reliable solution. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Share this post Link to post Share on other sites
Nine 921 Posted February 27, 2020 It was not aimed at you @Musashi nor at OP either. Was just a general comment. Sorry if it seems a bit harsh. Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Musashi 305 Posted February 27, 2020 39 minutes ago, Nine said: It was not aimed at you @Musashi nor at OP either. Was just a general comment. Sorry if it seems a bit harsh. I didn't consider your remark to be harsh, otherwise I would not have given it a 'Like' . Sometimes answers will be provided, that are within the scope of the user question, although more appropriate solutions would be preferable. That is exactly what you did - you have suggested a better approach. 1 Nine reacted to this "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Share this post Link to post Share on other sites