Jump to content

Search the Community

Showing results for tags 'cmd'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum
  • AutoIt


  • Community Calendar

Found 54 results

  1. Hi all, I have a csv file as below, I wand to find srno from csv and send corresponding ip and pass to commend cmd prompt. Please guide me to create script . srno,name,ip,pass 1,name1,ip1,pass1 2,name2,ip2,pass2
  2. cmd Unicode text maker

    Hi dear With this script you can print Unicode text in the CMD screen the script is easy to use just you write the text that contains Unicode in the first input and the script automatically reflect the code in the second input you can copy the text to the clipboard or you can try printing the text in the CMD window I apologize to everyone for colors and shape if not appropriate I'm a blind man and I do not see Thank you for your understanding Greetings to all of youCmdUtM.au3
  3. Hello Everyone, I seem to have run into an issue with Windows 10. When running (See Below) on windows 10 it prompt for user opens cmd as admin and does nothing. If I run the same code without (#RequireAdmin) everything works. I never had these issue with Windows 7 is there something I am missing. Thank you in advance! #RequireAdmin run ("cmd") WinWaitActive ("Administrator: C:\WINDOWS\SYSTEM32\CMD.exe") ControlSend ("Test") Send("{enter}")
  4. Hi. Thanks to this post (https://www.autoitscript.com/forum/topic/189553-writing-to-cmd/?do=findComment&comment=1361142) I can now write a helpfile to the cmd when for instance passing parameter -h or -help at cmd. But then cmd is blocked by the script (I had to free it with CTRL+BREAK): #include <WinAPI.au3> _WinAPI_AttachConsole() $hConsole = _WinAPI_GetStdHandle(1) _WinAPI_WriteConsole($hConsole, "Print helpfile................" & @CRLF) Inside MSDN Library then I found this sentence: A process can use the FreeConsole function to detach itself from its console. But I don't find something like _WinAPI_FreeConsole(). How can I do it in another way? Regards, Conrad
  5. Hello I would like to know if there is a way to return a sentence in cmd when I launch from it (because I add arguments). For example, diskpart.exe which help to manage the key and hdd connected, when you launch it with the parameter "/f" the app return a sentence saying that it don't recognize the parameter "/f" and it return the sentence in the cmd where i started the application, not a new one. That's what I want to do but I couldn't find anything that would solve my problem on internet and on AutoIt like ConsoleWrite / ConsoleWriteError (don't work). Thanks
  6. I'm attempting to capture the output from the command line tool PSEXEC. I'm using AutoIT to run an instance of PSEXEC against a remote PC to audit Local Admins in my environment using net.exe (C:\Windows\System32> net localgroup administrators). However the usual trick I use to capture command line output does not appear to work well with PSEXEC, as the bottom portion of the output is missing from the return. Any ideas or recommendations are greatly appreciated. Here is what I'm working with: ;This script will read from a list of hosts and report who has local admin privileges on the machine #RequireAdmin Global $fileName = @ScriptDir & '\test.txt' ;hostlist, one host per line readHostList() ;Read list of hosts Func readHostList() Local $file = FileOpen($fileName, 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ConsoleWrite($line & @CRLF) ;MsgBox(0,0,$line) getLocalAdmins($line) WEnd FileClose($file) EndFunc ;run PSEXEC to list local admins Func getLocalAdmins($remotePC) Local $testFile = @ScriptDir &'\test234.txt' FileOpen($testFile, 1) Local $psexec = 'psexec \\' & $remotePC & ' net localgroup administrators' FileWriteLine($testFile, _RunCmd($psexec) ) FileClose($testFile) EndFunc ;Used to return CLI output Func _RunCmd($sCommand) Local $nPid = Run(@Comspec & " /c" & $sCommand, @SystemDir, @SW_Hide, 8), $sRet = "" If @Error then Return "ERROR:" & @ERROR ProcessWait($nPid) While 1 $sRet &= StdoutRead($nPID) If @error Or (Not ProcessExists ($nPid)) Then ExitLoop WEnd Return $sRet EndFunc ## If i manually run the command on the remote PC via PSEXEC I will get the following output: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Starting net on PCNAME... on PCNAME... net exited on PCNAME with error code 0. ------------------------------------------------------------------------------- admin Administrator Alias name administrators Domain\Domain Admins Comment Administrators have complete and unrestricted access to the computer/domain Members The command completed successfully. ## The returned output from running the above script is as follows: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Alias name administrators Connecting to PCNAME... Starting PSEXESVC service on PCNAME... Connecting with PsExec service on PCName... Starting net on PCNAME.. net exited on PCNAME with error code 0. **Note to test this script PSEXEC must be in the system dir or the path in the script changed PSEXEC tool: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
  7. Hello, Im trying to read the output from CMD using Dllcall, here is my code: #include <WinAPI.au3> #include <array.au3> Global Const $STD_OUTPUT_HANDLE = -11 Global Const $_CONSOLE_SCREEN_BUFFER_INFO = _ "struct;int dwSizeX;" & _ "short dwSizeY;" & _ "short dwCursorPositionX;" & _ "short dwCursorPositionY;" & _ "short wAttributes;" & _ "short Left;" & _ "short Top;" & _ "short Right;" & _ "short Bottom;" & _ "short dwMaximumWindowSizeX;" & _ "short dwMaximumWindowSizeY;endstruct" $pCmd = Run( "cmd.exe" ) Sleep(1000) $hCmd = WinGetHandle("") ConsoleWrite('handle:' & $hCmd & @CRLF) $aRet = DllCall("kernel32.dll", "int", "AttachConsole", "dword", $pCmd) ;_ArrayDisplay($aRet) If $aRet[0] <> 0 Then $vHandle_data='' $vHandle='' $vHandle_data = DllStructCreate($_CONSOLE_SCREEN_BUFFER_INFO) ; Screen Buffer structure $aRet1 = DllCall("kernel32.dll", "hwnd", "GetStdHandle", "dword", $STD_OUTPUT_HANDLE) if not @error Then $vHandle = $aRet1[0] $aRet = DllCall("kernel32.dll", "int", "GetConsoleScreenBufferInfo", "hwnd", $vHandle, _ "ptr", $vHandle_data) MsgBox(0, '1',DllStructGetData($vHandle_data, 'dwSizeX') & _WinAPI_GetLastErrorMessage()) EndIf It did not work, i got the message 'The handle is invalid'. Please help? Thank you in advance!
  8. Hello, I compiled a script I made that takes a command line parameter (the version of a .msi installer) when launched. The script was compiled with the /console option. The script (.au3) works fine but the executable returns the following error: Error: array variable has incorrect number of subscripts or subscript dimension range exceeded
  9. Hi everyone. I'm currently working a program that constantly prints out log files through "consolewrite" and the "#AutoIt3Wrapper_Change2CUI=y" wrapper. Part of this program requires me to run a batch script. My issue is the batch script launches from the same window as consolewrite. I need the batch file to be launched through a different window as currently this causes an issue with the logs (which need to be very precise) but also causes the batch file to produce some funny behavior... Does anyone know how I can force the file to run on a second DOS window? Thanks in advance!!! Edit: Im using the "run" command if that helps. I tried "shellexecute" but that seemed to not launch the batch scripts at all.
  10. Hi all, I need to start a script that include: - admin privileges - multiple cmd commands - no bat, no exe, no tmp files created anywhere (especially in the user temp folder) In a bat file it would be simple, but users shouldn't see what commands I'm sending. Example of the script: echo off cls echo. echo I AM A TOOL echo. echo NOTE: echo - note 1 echo - note 2 echo - etc set USER1=0 set COMPUTER1=0 if /i %username% equ user.user ( set USER1=1 set COMPUTER1=1 ) if /i %username% equ another.user set USER1=1 if /i %computername% equ notebook set COMPUTER1=1 if %USER1% EQU 1 ( if %COMPUTER1% EQU 1 ( reg delete "HKLM\SOFTWARE\blablabla" /f ) else ( echo Computer not authorized. Contact assistance.) ) else ( echo User not authorized. Contact assistance.) echo. pause exit With the send("") is a disaster. I'm a noob here, so what can I do? EDIT: OR ELSE I explain the situation and what I need, so if there is a simple solution I can use that. SITUATION: our domain users have Users rights on the machine. Some of them need administrator rights. We create a local user with administrator rights, so that the users must insert username and password when asked to run something with administrator rights. We have an internal domain group policy that blocks EXE, BAT, COM, TMP files from the user local temp directory, for a security reason (malware). That also blocks most software installation. But some users are often out of office, away from workplace and in another country, they need a complete control on their computers. WHAT I NEED: I need to check the username and the computer name. If the username is the one with local administrator rights and the computer name is a computer that is qualified to temporary remove the policy, then I need to execute a REG DELETE command with administrator rights. I hope I explained myself. Thank you very much.
  11. Hi! I'm triying to get the session id to close automatically a RDP session. I tried doing this: #RequireAdmin #include <Constants.au3> $DOS = Run('C:\Windows\System32\query.exe user', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;Run(@ComSpec & " /c " & 'Query User', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;Run(@ComSpec & " /c " & 'quser', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) MsgBox(0,'',$Message) But the $Message is always empty, if I execute any of these commands in a cmd window, it works Any idea on why is this falling? there is another way to get this info? PS: Sorry for my english, i'm not native.
  12. Command line

    I did not see any example like this one I type that line at the dos cmd prompt and it's run I am wondering , how to do the same with autoit $step3Cmd = "d:\ClientAdmin\RetailPatch\retailPatch.bat storeregister r07v06 stop-pos-and-change-N"
  13. Good morning AutoIt community! Today, I'm here to ask you if you know how to run an .exe from cmd.exe ( Command Prompt )... My intention is to read a .ini file where I store an information that has to be included in the shell, and run an .exe with that information... I'll give you an example Local $aFileCartellaAuditCopy = _FileListToArray($sPercorsoAuditCopy, "*.txt") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura della lista dei file nella directory" & @CRLF & $sPercorsoAuditCopy & @CRLF & "Errore: " & @error) Return False Else Local $iPID = Run("cmd.exe" & ' /k "C:\Users\Portatile-60\Desktop\HmiCheckLogIntegrity.exe" "C:\Users\Portatile-60\Desktop\AuditTrailDosaggio0_20170327_151335_DOSAGGIO_PW_01.txt"') ; & " /k " & '"' & $sHmiCheckLogIntegrity & '"' & " " & '"' & $sPercorsoAuditCopy & "\" & $aFileCartellaAuditCopy[1] & '"', "", @SW_SHOW, $STDOUT_CHILD) Return True EndIf This code is in a function, that returns False if it can retrive at least a file from the path stored in the .ini file... Else I would like to run the Command Prompt with the .exe and with a parameter of that .exe, but it seems to not work properly. Could please anyone tell me why? Thanks
  14. Hi guys, This is probably an obvious one, but I really don't use this command at all so am hoping you can spot my mistake. I'm running a powershell script on a schedule with the following script in a function, the function is being called in a loop, but the console process is not closing in the background and I end up with a bunch of console windows running in the background: Run(@comspec & ' /k PowerShell.exe -STA -NonInteractive -ExecutionPolicy ByPass -Command "& ''Z:\Powershell\365\GetNextDetails.ps1'' "', "", @SW_HIDE) Thanks!
  15. I am trying to send a CTRL+G to a command prompt. It should send something like ^G this to the prompt but instead it sends only the G. To give more insight into what I am trying to create here: At my work we need a programm to open de cashdrawer using the commandprompt, i created a gui where you can set the COM-port to wich the command should be send. This works the COM-port setting is writting in a .ini file to be used every time the program opens. I have attached the files to the post. Hope someone can help me. open.zip
  16. Trying to automate the sideload of a Windows Store app via .ps1 script... RunWait(@ComSpec & ' /c' & 'C:\"WB Resources"\APP_Prod\Add-AppDevPackage.ps1') Above doesn't work... I assume this is trying to open in CMD. Normally we right click the .ps1 and open with powershell, then we have to type "A" to start the install, it installs and then type any yet to exit. However I cant get the powershell to even open. Kind of puzzled here, any suggestions would be a help. PS I also tried to convert the .ps1 to exe, but that was a huge failure... lol
  17. While Runwait

    Hello, I just wrote a script that should copy data into my cloud using xcopy (cmd), but I want the Status Bar I have in my GUI to change it's text like that: working. -> working.. -> working... -> working. ... I would also like to make a button which interrupts xcopy (simply closing it should do the trick), but I don't know how to call ProcessClose("xcopy.exe") using a button, while I'am waiting for RunWait to finish. Example: $command = 'xcopy "' & @DesktopDir & '\text.txt"' & ' "\\ADMIN-CLOUD\private\" /EECHIY' $SW_STATE = @SW_HIDE RunWait(@ComSpec & " /c " & '"' & $command & '"', @DesktopDir, $SW_State) Please tell me if you need any further information!
  18. I have this button in an app I am building: When you click it, it then opens a FileOpenDialog() I select and XML, then it asks for a name input, enter the name, then it should run the following code: schtasks.exe /create /tn XXXX-task /XML C:\WBRESO~1\WB-LOO~1\TESTIN~1.XML It works when I put it in the CMD and run it, I get SUCCESS! and the new task has been created in Task Scheduler. C:\Users\vivaed>schtasks.exe /create /tn XXXX /xml C:\WBRESO~1\WB-LOO~1\TESTIN~1.XML SUCCESS: The scheduled task "XXXX" has successfully been created. But when I run it in: (This is just a snippet of the code, there is a lot more) #include <AutoItConstants.au3> Global $wbResources = 'C:\"WB Resources"\WB-LoopChecker\' Case $Button4 $getXML = FileOpenDialog("Find task to import", $wbResources ,"XML (*.xml)") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file was selected.") Else Local $taskName = InputBox("Name this task","File: " & @CRLF & $getXML & @CRLF & "Name this task:" & @CRLF,"XXXX-task") $schedTask = 'schtasks.exe /create /tn ' & $taskName & ' /XML ' & FileGetShortName($getXML) Run(@ComSpec & " /c " & $schedTask, @SW_HIDE) ConsoleWrite($wbResources & @CRLF) ConsoleWrite($schedTask & @CRLF) EndIf Here I dont get any errors but the when I refresh the Task Scheduler, there is no new task....
  19. Hey fellow scripters! I wanted to create a script to change the bitlocker PIN of our Win7 machines for users without admin rights. While researching I found out, that this doesn't seem to be an easy task. I came up with a pretty dirty solution: $gui=GUICreate("Bitlocker PIN",180,180,-1,-1,$WS_SYSMENU,-1) GUICtrlCreateLabel("PIN eingeben (min. 6 Zeichen):",15,15,150,15,-1,-1) $bit1=GUICtrlCreateInput("",15,30,150,20,$ES_PASSWORD,$WS_EX_CLIENTEDGE) GUICtrlCreateLabel("PIN bestätigen:",15,60,77,15,-1,-1) $bit2=GUICtrlCreateInput("",15,75,150,20,$ES_PASSWORD,$WS_EX_CLIENTEDGE) $button=GUICtrlCreateButton("Neue PIN Setzen",35,110,110,30, $BS_DEFPUSHBUTTON, -1) GUISetState(@SW_SHOW,$gui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ExitLoop Case $button $res1=GUICtrlRead($bit1) $res2=GUICtrlRead($bit2) If $res1 = $res2 And StringLen($res1) >= 6 Then GUISetState(@SW_HIDE,$gui) ClipPut ($res1) BlockInput(1) $proc=RunAs($o1acc, $domain, $o1pwd, 2, @ComSpec & " /c C:\Windows\System32\manage-bde.exe -changepin c:") WinWaitActive("C:\Windows\system32\cmd.exe","") Sleep(2000) Send ("!{Space}") Sleep(20) Send ("B") Sleep(20) Send ("E") Sleep(20) Send ("{ENTER}") Sleep(100) Send ("!{Space}") Sleep(20) Send ("B") Sleep(20) Send ("E") Sleep(20) Send ("{ENTER}") WinWaitClose("C:\Windows\system32\cmd.exe") Sleep(100) BlockInput(0) ExitLoop ElseIf StringLen($res1) < 6 Then MsgBox($MB_ICONERROR,"Fehler","PIN zu kurz. Minimum 6 Zeichen.") Else MsgBox($MB_ICONERROR,"Fehler","PINs sind nicht gleich."&@WindowsDir) EndIf EndSwitch Sleep(20) WEnd It works on my test system, but the problem here is, that a user could easily pause the script and have a nice cmd with elevated rights. So I wanted to give $STDIN_CHILD + $STDOUT_CHILD and StdoutRead + StdinWrite a try. The problem here was, that when I executed the command it would give me the following output: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten. C:\Windows\System32>manage-bde.exe -changepin c: BitLocker-Laufwerkverschlüsselung: Konfigurationstoolversion 6.1.7601 Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. FEHLER: Ein Fehler ist aufgetreten (Code 0x80070006): Das Handle ist ungültig. ~ Error: An error occured (Code 0x80070006) Invalid handle . This is the code that I tried: $pid = RunAs($acc, $domain, $pwd, 2, @ComSpec, "C:\Windows\System32\", @SW_SHOW, BitOR($STDERR_CHILD, $STDIN_CHILD, $STDOUT_CHILD)) StdinWrite($pid, "manage-bde.exe -changepin c:" & @CRLF) While Sleep(50) $sOut = StdoutRead($pid) If @error Then ExitLoop If $sOut <> "" Then ConsoleWrite($sOut & @CRLF) WEnd Has anyone experienced errors like this (or has a better solution for changing the bitlocker PIN)? Regards ino
  20. How can I check wether my current autoitscript (.exe) has finished, my problem is that I have a button which starts the autoit, if the user clicks twice in the button or more times the script shall check if its runs or not
  21. How can I run this command:      Send( 'C:\xampp\htdocs\myApp\BuildDVD.exe ..\..\projects\dvdrom\' & $sFileName & '\project.xml ..\..\projects\' & $sFileName & '\video') in a Shell Execute? I can run ShellExecute('C:\xampp\htdocs\myApp\BuildDVD.exe') but how to I add the rest of the command?
  22. I am trying to spawn a cmd.exe shell on a remote machine using psexec then proceed to running commands on that machine and reading the output. I.e. running pwd. Unfortunately, the code I have now will just immediately exit cmd on the remote system I'm trying to use the current code #include <Constants.au3> $pid = Run('C:\Users\test\Desktop\psexec.exe \\ -u test -p "P@$$word1" -h -s cmd',@SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($pid,"pwd") StdinWrite($pid,@CRLF) Local $data Sleep(2000) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) StdinWrite($pid,"cd ") StdinWrite($pid,"C:\users\test2") StdinWrite($pid,@CRLF) StdinWrite($pid) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) http://stackoverflow.com/questions/19206834/command-prompt-and-autoit-stdinwrite <- credits to this stack overflow post Unfortunately, on my end, my cmd just starts/stops with this prompt Connecting with PsExec service on 192.1.123...Starting cmd on cmd exited on with error code 0. Any ideas how I can keep my shell open over psexec and still interact with it using AutoIT? Any feed back would be amazing! Thanks!
  23. Hey guys! I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with: Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like: BENUTZERNAME SITZUNGSNAME ID STATUS LEERLAUF ANMELDEZEIT >wg console 2 Aktiv 17 25.07.2016 08:19 What I need right now is the ID. Any Idea on how to read it off of the Textfile? Please give me examples because I am still a rookie! With kind regards Eddi96
  24. ShellExecute("\\servername\cofs\Organization\ITS\_Software & Hardware\AS400\DVD\Windows\cwblaunch.exe", '"/v/qn ADDLOCAL=ALL"') I had to dig to find the right setup.exe according to the documentation but I got it to run. However, it pops up with this dialog box (attached) showing me the command line parameters, as if I'm incorrect. It continues to run the install however, but seemingly without any of the command line parameters. Here's the command I entered into the CMD prompt exactly: "\\servername\cofs\Organization\ITS\_Software & Hardware\AS400\DVD\Windows\image64a\setup.exe",'"/v/qn ADDLOCAL=ALL"'
  25. Hey guys, for some reason when I run this command with run as in autoit it returns access is denied. but when I run the same thing in an elevated command shell it works fine. Im not sure where I am messing up. global $rtech,$rcred, $IP $rtech = inputbox("","username") $rcred = InputBox("","password") $ip = inputbox("","enter IP") $pid = Runas ($rtech,"mhs", $rcred, 2 ,@ComSpec & ' /c reg query \\' & $ip & '"\hklm\software\microsoft\windows\currentversion\group policy\state\machine"|findstr /i "disting"', @SystemDir, @SW_hide, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($pid) If @error Then ExitLoop WEnd While 1 $line &= StderrRead($pid) If @error Then ExitLoop WEnd MsgBox(0, "", $line)