Jump to content
Sign in to follow this  
Garrett19212

How to move file

Recommended Posts

Garrett19212

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
buzz44

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


qq

Share this post


Link to post
Share on other sites
Rex

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
MHz

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
Rex

@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
Garrett19212

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
steveR

$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
Garrett19212

$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
MHz

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
Garrett19212

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
Rex

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.