Jump to content

ICACLS - Whitespace issue


Recommended Posts

Hi all, 

I am trying to create a directory, give everyone full access to the directory (and exe within), and then make a shortcut to the .exe to the Startup Folder for Windows, so that all users launch this application on startup.

However, my ICACLS cmd works just fine through the cmd, it is not taking through Autoit, for what I can only guess is a white space issue. I have not been able to figure this one out yet, as it was working on my personal machine, but at work this morning, no go :(. Please see code below. 

 

if $arch = "X64" Then
      $dir_path = "C:\Program Files (x86)\OneTouch"
      $app_path = $dir_path&"\OneTouch_Locator_64.exe"

      FileDelete(@MyDocumentsDir&"\OneTouch_Locator_32.exe")
      DirCreate($dir_path)

      FileMove(@MyDocumentsDir&"\OneTouch_Locator_64.exe",$app_path )
        $command = "icacls "&$dir_path&" /grant Users:(OI)(CI)F  /T"
          consolewrite($command)
          $Pid = Run( $command )
            ProcessWaitClose($Pid)


      FileCreateShortcut($app_path,"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\OneTouch_Locator_64.exe")

 

Edited by Busturdust
Link to comment
Share on other sites

  • Moderators

Why not try something like this, so you can keep the window open and see the output?

Run(@ComSpec & " /k " & $command, "", @SW_SHOW)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for the input JLogan, it appears the string was fine and that the ultimate issue was an inconsistency between machines.

 

For some reason, at work the following line

/grant Users:(OI)(CI)F  /T"

Needs to be replaced with 

/grant Users:(OI)(CI)(F)  /T"

Even though an explicit CMD execution with the 1st, works, it does not work trhough AutoIT for me. 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...