Sign in to follow this  
Followers 0
Busturdust

ICACLS - Whitespace issue

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



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

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

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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. 

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