Jump to content

Search the Community

Showing results for tags 'comspec'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 13 results

  1. Hope someone can help as quotes within quotes is always confusing. I am creating a silent install of printer software and want to call via runwait comspec line. The call within a cmd line is below samsung.exe /s /n"Samsung SL-M3220ND" /p"xxx" xxx will be stored as a variable $PrinterIP which would be as example 10.10.10.20 I need to use a variable as i am doign this for a business and need it to be based on the store i install at that has a specific IP range. I started with the below as 2 possibilities but no luck.. RunWait(@ComSpec & "/c " & "samsung.exe /s /n""Samsung SL-M3220ND"" /p""" & $PrinterIP ") RunWait(@ComSpec & "/c " & "samsung.exe /s /n'Samsung SL-M3220ND' /p'" & $PrinterIP '") but i cant get it to compile as i have errors on the line.. thanks in advance.
  2. 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
  3. 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!
  4. Hello, I've some troubles whit the run command. Below u see 2 command's , 1 is working and the other not. (the first isn't working) I think the problem is in te space between program and files.Also I've treid every thing i could think of or the helpfiles handed to me. (or maybe I din't find the correct answer:)) I tried so mush that i don't know anymore if it's the space between program files or not. Could somebody point me in the right direction? Not working: Run(@ComSpec & " /c psexec -i \\127.0.0.1 -u username -p pass -h -d /accepteula C:\Program Files\some_prog\Shell.exe" ,"C:\tools", @SW_HIDE) Working : Run(@ComSpec & " /c psexec -i \\127.0.0.1 -u username -p pass /accepteula cmd" , "C:\tools" , @SW_HIDE)
  5. hello, I'm trying to make a check if a process is running on a remote PC. This is what i got this far when I edit a found snippet on this forum. The function _CMDreturn returns the output of the command line command. In this output I want to scan if there is a line whit "process mspaint was not found". This I'm trying to do whit StringLeft. The problem is that I don't get any error's and also don't get a message if it doesn't exist. Could somebody say to me what I'm doing wrong here? Or iff there is a better way to do this? Thanks in advanced. #include <Constants.au3> $result= _CMDreturn('C:\Tools\Ps\pslist.exe mspaint') msgbox(0,"Version",$result) Func _CMDreturn($sCommand) $cmdreturn = "" $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD) While 1 $line = StdoutRead($stream) If @error Then ExitLoop If StringLeft($line, 32) = "process mspaint was not found on" Then msgbox(0,"not found",$line) EndIf $cmdreturn &= $line WEnd Return $cmdreturn EndFunc
  6. Hi, I want to install chocolatey (https://chocolatey.org/) with AutoIt. I just need to send the following command to cmd: @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\binThis is what I tried: RunWait(@ComSpec & " /C " "@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin", "");It didn't work propably because of the quotes. So I tried this: $code1 = "@powershell -NoProfile -ExecutionPolicy unrestricted -Command" $code2 = " (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" $code3 = " && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RunWait(@ComSpec & " /C " & $code1 & $code2 & $code3, "");Didn't work either. Any help? Thanks in advance =)
  7. Hello everyone, I'm working on a WMIC uninstaller. A quite simple one with a button to display product names in a editable list (for copy/paste purposes) but the main problem is that in order to achieve this, in my corporation, normal users cannot uninstall softs. What I found/adapt so far: #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("wmic uninstaller", 300, 152, 337, 380) $Label1 = GUICtrlCreateLabel("Computername", 0, 8, 75, 17) $Input1 = GUICtrlCreateInput(@ComputerName, 0, 32, 125, 21) $Label2 = GUICtrlCreateLabel("wmic command", 150, 8, 77, 17) $Combo1 = GUICtrlCreateCombo("Model_Computer", 150, 32, 125, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Current_user|Installed_Apps|Serial_Number|Bios_Version") $Button1 = GUICtrlCreateButton("List Apps", 150, 72, 91, 49) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 $wmi = GUICtrlRead($combo1) $pc = GUICtrlRead($input1) call($wmi,$pc) EndSwitch WEnd Func Model_Computer($pc) RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' product get name > %temp%\apps.txt' ,"", @SW_HIDE) $file=(@TempDir & "/apps.txt") $fileread= FileRead($file) MsgBox(0, $pc , $fileread) FileDelete(@TempDir & "/apps.txt") EndFunc Here's the textual version I gave to my techs: Create cmd shortcut on Desktop, run it as a different user (using their own admin accounts).Once opened, type wmicOnce wmic loaded, type product get nameWait for the list of installed soft to displayType product where name="Exact App name" call uninstallType "Y" to confirmWait for task executionDon't care about exit codeApp is uninstalled (verified by getting the list again)!In fact, I'd like to automatize this process. Any ideas over here? Thanks ^^
  8. Hi guys, I have this batch file that run the following code and it work fine. C:\Windows\System32\cmd.exe /C set __COMPAT_LAYER=RunAsInvoker & start "" "C:\Program Files\test 123\test 123.exe" but I'm trying to use autoit @comspec to compile it to a executable file. I'm having problem with the syntax. Can anyone be kind enough to guide me. This is the @comspec code I try. RunWait(@Comspec & ' /c set __COMPAT_LAYER=RunAsInvoker ' & 'start' & 'C:\Program Files\test 123\test 123.exe')
  9. I'm using my script to monitor established connections with the network. I'm using combination of RUN and NETSTAT command, however, constantly calling netstat from CMD doesn't feel elegant enough, and it's causing my script to perform really slow. Is there more elegant solution, an alternative for calling netstat?
  10. It doesn't seem that I can run Sysprep in Windows 8 RP x64 using @ComSpec. I have no problem running other apps using either Run() or RunWait() in the same app. I am testing in Audit Mode (Administrator account, UAC is disabled). I already searched the forums and didn't find any one else trying to execute Sysprep like this... This does not work when run compiled: Run ( @ComSpec & " /c c:\windows\system32\sysprep\sysprep.exe /oobe /shutdown") Returns error "is not recognized as an internal or external command, operable program or batch file." I don't know how to keep the ComSpec window open, so the only way for me to see this was to hold down the Enter key so I could see the error. Curiously, running this manually works fine: cmd.exe /c c:\windows\system32\sysprep\sysprep.exe /oobe /shutdown App is compiled for x86. OH! Do not try to run this on your workstation!!!
  11. Can't make it work when spaces are in the directory names. Tried the following: FYI (c:tempnew folder) is a @ScriptDir CMD DOS (batch) WORKS "c:tempMy Folderappspsloglist.exe" -accepteula -d 14 Application > "c:tempmy Folderout12.txt" AutoIT Does Not RunWait(@ComSpec & ' /c "'&@ScriptDir&'appspsloglist.exe" -accepteula -d 14 Application > "'&@ScriptDir&'out12.txt"','',@SW_SHOWNORMAL) Please help
  12. Can't make it work when spaces are in the directory names. Tried any possible quotations.. All my directories and script in "My Documents" Your help will be appreciated!! Global $ToolPath = @ScriptDir&"\Myutility" ;;;; \My Documents\main.au3) Global $myoutput = $ToolPath&"\output" Global $appspath = $ToolPath&"\apps" Global $foldertochecksum = @ProgramFilesDir $runme = @ComSpec & ' /c ' & $appspath&'\md5sums.exe -n -e -b' & ' ' &$foldertochecksum& ' > ' & $myoutput&'\out.txt' msgbox(0,"",$runme) RunWait($runme,"",@SW_HIDE)
  13. It's Weird. I think I don't get it. Why it doesn't work like it is supposed to? I need to create a Script to monitor one of our fileservers to check how many users and what users opens how many .EXEs at this server. The DOS command to do that is simple: openfiles /query /FO table /V /nh | find /I ".exe" > exportx.log The DOS command typed at it's prompt. The report out is something like that (and exactly what I need AutoIt to run from 30 to 30 minutes): [text] SERVER80 3487273 JULIAN Windows 0 Read R:\PWD\PWD_APP\rpc.exe SERVER80 5644134 WELTON Windows 0 Read R:\SUPORT\Gho11\Gho5.Exe SERVER80 6251031 DARLEYMX Windows 0 Read R:\DEVELOPMENT\APPS\Applications.S.Winform.exe SERVER80 6591869 ELCIOVS Windows 0 Read R:\SUPORT\Prog\VC\vcvw.exe SERVER80 7984711 SANDREO Windows 0 Read R:\SUPORTE\UTILITARIOS\WinStress\WinStress.exe SERVER80 8399253 BRIANB Windows 0 Read R:\DEVELOPMENT\FONTS\PGCD\APGC.exe [/text] Okay, so, as I've used before with other DOS commands, I inserted that command into a @compsec line, But it just won't work. If you read below there, you'll see how many different attempts I tried. No success. If Not FileExists(@ScriptDir & "\Export") Then DirCreate(@ScriptDir & "\Export") EndIf Global $Hour = "_" & @HOUR & "'" & @MIN & "''" Global $Date = @YEAR & "-" & @MON & "-" & @MDAY Global $FullDate = $Date & "_" & $Hour Global $ReportOut = $FullDate & "_" & IniRead("Config.ini", "ReportOut", "ReportOut", "Report") Global $ReportDir = @ScriptDir & "\Export\" Global $FilterExt = IniRead("Config.ini", "FilterExt", "FilterExt", "N") Global $FileExt = '".' & IniRead("Config.ini", "FileExt", "FileExt", "exe" & '"') Global $FormatOut = IniRead("Config.ini", "FormatOut", "FormatOut", "Table") Global $QueryCommand = "/query " & "/FO " & $FormatOut & " /V " & "/nh " Global $FindCommand = "| find /I " & $FileExt Global $ExportCommand = " > " & $ReportOut & ".log" Global $CommandCombo If $FilterExt = "Y" Then $CommandCombo = $QueryCommand & $FindCommand & $ExportCommand Else $CommandCombo = $QueryCommand & $ExportCommand EndIf ;openfiles /query /FO table /V /nh | find /I ".exe" > exportx.log <--- Command to be used: ;/query /FO '& $FormatOut &' /V /nh | find /I "' & $Extension & '" > ' & $ExportFile & '" "' ;Local $PID = RunAs("adm-user", "DomainX", "P@ssW0rDX", 4, Run(@ComSpec & "/c openfiles /query /FO table /V /nh | find " & $FileExt & " > exportx.log", @ScriptDir), @ScriptDir) ; <--- The entire command. Didn't work ;local $PID = RunAs("adm-user", "DomainX", "P@ssW0rDX", 4, Run(@ComSpec & "/c openfiles " & $CommandCombo & " ", @ScriptDir), @ScriptDir) ; <--- Narrowed down the arguments to a single variable. Didn't work Local $PID = RunAs("adm-user", "DomainX", "P@ssW0rDX", 4, Run(@ComSpec & "/c openfilescommandline.bat", @ScriptDir), @ScriptDir) ; It was created a bat file that works when executed manually, but doesn't when executed through @comspec MsgBox(0, "", $CommandCombo) Local $pidreal = StdoutRead($PID) MsgBox(0, "", $pidreal) FYI, The ini file is as follows: [FilterExt] FilterExt = Y [FileExt] #FileExt = ".exe" [ReportOut] ReportOut = _Report [FormatOut] FormatOut = table Can anyone tell me what is my sin? Thanks in advance.
×
×
  • Create New...