Sign in to follow this  
Followers 0
lolipop

Anyone can help with this @comspec syntax???

4 posts in this topic

#1 ·  Posted (edited)

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')
Edited by lolipop

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

RunWait(@Comspec & ' /c set __COMPAT_LAYER=RunAsInvoker ' & 'start' & 'C:Program Filestest 123test 123.exe')

Should be

RunWait(@Comspec & ' /C set __COMPAT_LAYER=RunAsInvoker & start "" "C:Program Filestest 123test 123.exe"')

Edited by santaryan

Share this post


Link to post
Share on other sites

Try:

RunWait(@Comspec & ' /c set __COMPAT_LAYER=RunAsInvoker & start "" "C:\Program Files\test 123\test 123.exe"')

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks Jos & Santaryan. It works prefectly...Thanks...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      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  
    • WoodGrain
      By WoodGrain
      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!
    • FMS
      By FMS
      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)  
       
       
       
       
       
       
    • FMS
      By FMS
      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  
    • Eggsplorer
      By Eggsplorer
      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\bin This 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 =)