Sign in to follow this  
Followers 0
Garrett19212

How to move file

12 posts in this topic

How can i make the script move itself to the startup folder so it will run everytime you start ur comp.

I mean like wats the code to make it move itself to that folder.

Share this post


Link to post
Share on other sites

u dont put it in a folder to run on startup... u need to put it in the registry

i forget the key name sry


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Ther are a few places in the registry u can put a ref.

If it's only once the script should run then.

1. the script only runs under current user

2. is global or for all users

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

or

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

If you want it to run every time the ps starts, then you have 2 choices.

1. the script only runs under current user

2. is global or for all users

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

or

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

Share this post


Link to post
Share on other sites

rember to use \\ and not \ in paths

Only *.reg files use \\ for registry entries. Not Autoit or Reg.exe. :)

Share this post


Link to post
Share on other sites

@MHz

U'r right. I should have mentionet it in my post.

Im still new to AutoIt, and still have hangovers form dos programming where i call *.reg files. :-)

Share this post


Link to post
Share on other sites

So wat would the code be for it to copy its self to the registry to it starts up every time

Share this post


Link to post
Share on other sites

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = "Notepad"
$filePath = "C:\Windows\notepad.exe"
regWrite($regpath, $progName, "REG_SZ", $filePath)


AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.

Share this post


Link to post
Share on other sites

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = "Notepad"
$filePath = "C:\Windows\notepad.exe"
regWrite($regpath, $progName, "REG_SZ", $filePath)

<{POST_SNAPBACK}>

Wat would it be for my program? Say the name of it is test.exe

Would it be

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = "test"
$filePath = "C:\Windows\test.exe"
regWrite($regpath, $progName, "REG_SZ", $filePath)

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

This might be easier ?

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = StringTrimRight(@ScriptName, 4)
$filePath = FileGetShortName(@ScriptFullPath)
regWrite($regpath, $progName, "REG_SZ", $filePath)

Share this post


Link to post
Share on other sites

How would i do an

If Than Else

for it?

Like

If it already exsists in the registry for startup than end if

Else create it in the registry for start up

End If

Share this post


Link to post
Share on other sites

How would i do an

If Than Else

for it?

Like

If it already exsists in the registry for startup than end if

Else create it in the registry for start up

End If

<{POST_SNAPBACK}>

You need to create a $var = regread(String)

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "String")
if Not $var = "prog.exe" then
MsgBox(0, "Prog","Dont exist")
Else
MsgBox(0, "Prog", "Eksist")
EndIf

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