Sign in to follow this  
Followers 0
ChromeFan

rename The exe itself and set permission

15 posts in this topic

#1 ·  Posted (edited)

First: can i rename the running exe itself?

Second: i want my script not to run if it was renamed. i have read about @AutoItExe , @ScriptFullPath and related macros but thay include the path and i can't restrict my script to run if it was renamed.

Edited by ChromeFan

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

use this macro: @ScriptFullPath

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

-.-

Edited by ChromeFan

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

use this macro: @ScriptFullPath

read my post again i already tried to use @ScriptFullPath Macro but it included the exe name also, please help me by giving a example to let me know the correct if i am doing something wrong. thanks for the quick reply!

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName

for Your first question try this:

$OldName = @ScriptFullPath
$NewName = "yourname.exe"
FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName)
FileDelete($OldName)
Edited by oMBra

Share this post


Link to post
Share on other sites

Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName

for Your first question try this:

$OldName = @ScriptFullPath
$NewName = "yourname.exe"
FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName)
FileDelete($OldName)oÝ÷ Ûú®¢×¢víÁ©í¶¬§¶ØZ¶l¬r¸©¶ÈhºWg¢Úî'â¶++zv¦yÛh²¶§Ilyú+{¦¦W­éÚê'±z+
{±y©Ýö§ÊÞ­éÚë"¶Ú(×±zØ^l¬r¸©¶ÈhºWg¢Ü(®KaDZjjezÈhÂËajضW¢²»§)à~º&>º ­©W¬¶§Ü"X"½æ¦zËæ§uÉh±ê-êðÇ¢·¥»§j¢Û¶nË^²Ö®¶­sdgVæ2FW7B¤bæ÷B7G&ætç7G"67&DF"Â&öw&ÔfÆW4F"FVà FW7B¤VÇ6P ×6t&÷ÂgV÷C²gV÷C²ÂgV÷Cµ'Væærg&öÒgV÷C²fײ67&DF"fײgV÷C²v62ç6FRgV÷C²fײ&öw&ÔfÆW4F"¢W@¤VæD`¤VæDgVæ0§FW7B

i just want to restrict my script don't work if it is renamed or it's name is Updated.


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

U can do:

$MyName = "New.exe"

If @ScriptName = $MyName Then
          ;run the script
Else
          Exit
EndIf
but how can i rename the running exe?

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName

for Your first question try this:

$OldName = @ScriptFullPath
$NewName = "yourname.exe" ; the name u want to set
FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName)
FileDelete($OldName)
this is the code a posted before... use it Edited by oMBra

Share this post


Link to post
Share on other sites

this is the code a posted before... use it

it is not working if the file itself is running.

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

u cant rename the file while running

Share this post


Link to post
Share on other sites

it is not working if the file itself is running.

It is not possible.

Window will not let you rename a running process.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

well if your "renaming" is in the first line of the script then you can do it like this

$OldName = @ScriptFullPath
$NewName = "yourname.exe"; the name u want to set
FileCopy(@ScriptFullPath, @ScriptDir & "\" & $NewName)
Run(@ScriptDir & "\" & $NewName)
ProcessClose(@ScriptName)
FileDelete($OldName)
Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites

It is not possible.

Window will not let you rename a running process.

yes, the file can be renamed while its running... i just did..

but it cannot be deleted...

try it yourself... run the file i attached then drag that file into list view and click "Start Shredding"

you'll see...

or if you dont trust the .exe, here's the source... (the file is working but not yet finished...)

Share this post


Link to post
Share on other sites

yes, the file can be renamed while its running... i just did..

but it cannot be deleted...

My mistake. You are correct the disk file can be renamed.

The usual AutoIt method of renaming files FileMove() will not work but using the dos RENAME command will.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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