Jump to content
acrane76

Delete a file with autoit

Recommended Posts

acrane76

hello how i can delete a file with autoit in this folder C:\Users\Public\Documents ? 

 

Run(@DocumentsCommonDir & "del /F /Q mmr.exe", "", @SW_HIDE)

 

Share this post


Link to post
Share on other sites
acrane76

i have tried this but this does not work

Share this post


Link to post
Share on other sites
Fr33b0w

With autoit maybe like this: FileDelete("c:\path_to_a_file") ?

Share this post


Link to post
Share on other sites
Jos
53 minutes ago, acrane76 said:

i have tried this but this does not work

Makes sense because when you concatenate @DocumentsCommonDir & "del /F /Q mmr.exe" you will miss an "\" between the directory and del.

Normally you would do:

run(@ComSpec & " /c del /F /Q mmr.exe", "", @SW_HIDE)

You need to make sure you have the cottect working dir!

 Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
acrane76

i want to delete this file only from this folder  C:\Users\Public\Documents how i can do this ?

Share this post


Link to post
Share on other sites
OldGuyWalking

You might want to take a look at the AutoIt help.  Click on the Contents tab.  Then look for the File, Directory, and DiskManagement heading in the tree on the right, wait... left (unless you're not facing the screen then it would be on your right).

Then, click on that File, Directory, and Disk Management heading and it will show you functions that will let you Create Files and Folders.  Delete Files and Folders.  Plus lots more.  It's cool...

But in case you don't have time....

FileDelete("C:\Users\Public\Documents\mmr.exe")

Good Luck.

Edited by OldGuyWalking
Confusion.

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

×