Jump to content

folder move


Recommended Posts

Ok so after I compile this script it creates the Dir but it doesn't copy the files. Ascripts is a folder and I want it to copy the files inside the folder.

its not working

#NoTrayIcon

AutoItSetOption("RunErrorsFatal", 0)
AutoItSetOption("TrayIconHide", 1)
Break(0)
$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0   ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')
   If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode")
   Exit
EndIf

   DirCreate ( "C:\Program Files\Ascripts" )

   FileCopy ( @DesktopDir & "\Ascripts", "C:\Program Files\Ascripts" ,1)

RunAsSet()

any ideas,

thanks

Link to comment
Share on other sites

According to help

i don't see the Administrators reference there????

8)

$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0 ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')

So the script is being run as Admistrator, loading the admin profile. This has been my problem, and the change I made doesn't work.

any ideas?

I changed it to a var because I thought I would be able to get the state of the current user before it ran as admin.

Actully it would be better if I was just able to get the file off of a local server seeing as I have to do it for several comps.

FileCopy ( $local server folder & "\Ascripts.*.*", "C:\Program Files\Ascripts\" ,1)

but I don't know how to get the address for the folder

Edited by skafreak_510
Link to comment
Share on other sites

Shoot me down if I am wrong but should you not be using DirCopy which will create the directory structure if it does not exist.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

DirCopy? I'm using DirCreate and FileCopy.

The point I am makeing is that if you use DirCopy you do not need to use Dircreate and FileCopy. If you want to keep useing your version should you not be using \Ascripts\*.* to copy the files in the folder.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

The point I am makeing is that if you use DirCopy you do not need to use Dircreate and FileCopy. If you want to keep useing your version should you not be using \Ascripts\*.* to copy the files in the folder.

thanks

But how do I write the address for a folder on my local server that is compadible with Autoit?

Link to comment
Share on other sites

thanks

But how do I write the address for a folder on my local server that is compadible with Autoit?

You could use DriveMapAdd and later use DriveMapDel to remove the mapping.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

So the script is being run as Admistrator, loading the admin profile. This has been my problem, and the change I made doesn't work.

any ideas?

I changed it to a var because I thought I would be able to get the state of the current user before it ran as admin.

see the options... read the entire help file

RunAsSet ( ["user", "domain", "password" [, options]] )

Parameters

username [optional] The user name to use.

domain [optional] The domain name to use.

password [optional] The password to use.

options [optional] 0 = do not load the user profile, 1 = (default) load the user profile, 2 = use for net credentials only

Actully it would be better if I was just able to get the file off of a local server seeing as I have to do it for several comps.

FileCopy ( $local server folder & "\Ascripts.*.*", "C:\Program Files\Ascripts\" ,1)

but I don't know how to get the address for the folder

here is a test for you

$output = FileOpen("\\YOUR COMPUTER NAME\c on stelth\temp\test2.txt",1); this worked on mine ....AND ALL MY OTHERS TOO @!@! 8)

filewriteline($output,"This was written successfully by " & @ComputerName)

8)

NEWHeader1.png

Link to comment
Share on other sites

It works well thanks.

Which version worked. I ask so that anyone with a similar problem in the future will find the correct solution by searching the forums.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Which version worked. I ask so that anyone with a similar problem in the future will find the correct solution by searching the forums.

#NoTrayIcon

$Desktop = @DesktopDir

AutoItSetOption("RunErrorsFatal", 0)
AutoItSetOption("TrayIconHide", 1)
Break(0)
$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0   ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')
   If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode")
   Exit
EndIf

   DirCopy ( "\\local server\Ascripts\", "C:\Program Files\Ascripts\" ,1)
RunAsSet()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...