Jump to content
Sign in to follow this  
ninhgiangbs

pls help me , Convert a batch file commands into AutoIt?

Recommended Posts

ninhgiangbs

Hi,

Anyone can help me converting the following batch file commands into AutoIt commands?
Regards

file .bat

TAKEOWN /f "%SystemRoot%\Media\Windows Navigation Start.wav" /a
CACLS "%SystemRoot%\Media\Windows Navigation Start.wav" /E /G Administrators:F
DEL /Q "%SystemRoot%\Media\Windows Navigation Start.wav"

pls help me converting --> .Au3 (autoit)

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Only "Del" can be changed to "FileDelete".

The rest needs to be executed by using "Run".

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ninhgiangbs

Thank you, I have tried and failed, it requires the use of 3  command /1 CMD

Share this post


Link to post
Share on other sites
water

Can you post what you have tried so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ninhgiangbs
  1. run('"' & @systemdir & 'TAKEOWN.exe" /f "%SystemRoot%MediaWindows Navigation Start.wav" /a')
  2. run('"' & @systemdir & 'CACLS.exe" "%SystemRoot%MediaWindows Navigation Start.wav" /E /G Administrators:F')
  3. run('"' & @systemdir & 'DEL.exe" /Q "%SystemRoot%MediaWindows Navigation Start.wav"')

Share this post


Link to post
Share on other sites
water

Here (Macro Reference) you can find a list of macros to replace the DOS macros (%SYSTEMROO% etc.) with.

Run(@Systemdir & '\TAKEOWN.exe /f ' & @SystemDir & '"\Media\Windows Navigation Start.wav"' & ' /a')

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
MHz

Here is quite a different way to do it. Environmental Variables will be expanded like in a command script. && runs the next command if the previous command was successful.

Opt('ExpandEnvStrings', 1)
RunWait('"%ComSpec%" /c ' & _
    'TAKEOWN.exe /f "%SystemRoot%\Media\Windows Navigation Start.wav" && ' & _
    'CACLS.exe "%SystemRoot%\Media\Windows Navigation Start.wav" /E /G Administrators:F && ' & _
    'DEL.exe /Q "%SystemRoot%\Media\Windows Navigation Start.wav"' _
    , @SystemDir, @SW_HIDE _
)
Opt('ExpandEnvStrings', 0)

For those who like CMD. I usually do like water shows though sometimes an exception makes me think of other ways. :)

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  

×