Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Auto Program Needed


  • Please log in to reply
14 replies to this topic

#1 1up2down

1up2down

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 08 November 2010 - 08:08 AM

I am looking for a program that will carry out fixed operations on my computer automatically. For instance, when I turn off the computer, I need it to copy certain files and folders from my C drive to my backup drive. Then when I turn the computer on again, I need it to copy them back again. Can anyone tell me if there are any such programs available.

I would be grateful for any help this group can give me, thank you.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:54 PM

Posted 08 November 2010 - 11:28 AM

You can do it yourself:
http://www.windows-help-central.com/windows-shutdown-script.html

#3 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 08 November 2010 - 12:35 PM

Looks complicated but I will give it a try Thanks

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:54 PM

Posted 08 November 2010 - 01:04 PM

Not really complicated. There are tons of examples of scripts to do just what you want. All you need to do is add them in the appropriate places. I don't know of any software that will specifically do what you want.

#5 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 08 November 2010 - 06:49 PM

It may not seem complicated to you but it does to me. I can't even see how to get started. I think what I need is someone to talk me through the process for first time.

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:54 PM

Posted 09 November 2010 - 10:00 AM

Sorry, I wasn't trying to be flip about it. All you literally need to do is search the web for a script that will copy files, alter the script slightly to use your file names and locations. Then use the instructions I linked to to run the script on shutdown. Then you need to alter the script to move files on startup using the same instructions.

So for example:
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\ScriptLog.txt" , "D:\Archive\", OverwriteExisting
becomes:
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "<location of file>" , "<location to save file>", OverwriteExisting
Just put in the path names.

All the scripts you should need are here:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/files/

So in order to teach yourself how to do this, you create a test script that moves a single file from one place to another, and set it to run on shutdown. Reboot your computer and see if it worked.

EDIT: This example uses VBScripts to accomplish what you want, but you certainly could use batch files, shell scripts, etc.

Edited by groovicus, 09 November 2010 - 10:39 AM.
clarification


#7 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 09 November 2010 - 03:28 PM

It still seems complicated to me, almost like writing a program, and when it comes to that I'm a complete novice.

First of all I need to overcome the first hurdle, where do I write the script. Looking at information online it appears I have to open a notepad and write the script in that. Then it says I have to write it's name and extension - .bat with the option Save as: All files.

Am I right so far?

#8 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:54 PM

Posted 09 November 2010 - 04:47 PM

Mostly. If you want to use a .bat file, then you use the extension .bat; a VBScript file uses a .vbs extension. Here is an example you can try:

Start up Notepad. Enter this text:
MsgBox "Hello World!"
Save it as "HelloWorld.vbs" (Or any name with a .vbs extension. You need to save it with the quotes if you are using the default Windows behavior of hiding file extensions). Open up Explorer, find the file you just saved, and double-click it. Yes, it's that easy.

Try another simple one: Again start up Notepad, but enter this text:
strMyName = InputBox ("Enter your name")
MsgBox strMyName & " is my master!"
Again, save it (any name with a .vbs extension) and double-click it. Easy.


Source

It still seems complicated to me, almost like writing a program, and when it comes to that I'm a complete novice.

It is programming, but fortunately there are so many examples freely available that you do not need to reinvent the wheel. You just need to put parts and pieces together with minor modifications.

#9 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 09 November 2010 - 05:31 PM

Thanks. Now you are talking my language. I will give that a try and let you know how it goes tomorrow.

#10 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 09 November 2010 - 06:05 PM

The first one "Hello World" was easy a worked a treat, but with the second

strMyName = InputBox "Tony" MsgBox strMyName & " is my master!"

I got an error message saying

Script: C:\Documents and Settings\Tony\Desktop\Tony.vbs
Line: 1
Char: 22
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error

Still, I am happy. At least I got over that first hurdle and know how begin writing scripts. Now other scripts will begin to make sense, even to a PC dummy like me. Thanks to your help.

#11 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 09 November 2010 - 06:12 PM

Tried it again removing the quotes in the middle of the message and it worked, no error message. It produced a copy of the notepad with the same message in it.

strMyName = InputBox "Tony MsgBox strMyName & is my master!"

#12 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:02:54 PM

Posted 09 November 2010 - 08:08 PM

Actually, it does not have to be VBScript or JScript script file. You can also use a command script (batch file) file.
See here : http://www.trishtech.com/win7/run_a_script_at_shutdown_in_windows_7.php
Also : http://www.windows-help-central.com/windows-shutdown-script.html

Edited by Romeo29, 09 November 2010 - 08:09 PM.


#13 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:54 PM

Posted 09 November 2010 - 08:10 PM

Sometimes when you do copy and paste, things like quotation marks do not translate well. In many instances, websites will sanitize quotation marks for double quote marks (easiest way to explain) to prevent things like script injection, etc.

Sounds like you are off and running!

#14 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 10 November 2010 - 02:33 PM

Sometimes when you do copy and paste, things like quotation marks do not translate well. In many instances, websites will sanitize quotation marks for double quote marks (easiest way to explain) to prevent things like script injection, etc.

Sounds like you are off and running!


Yes, you've got me started on something I think I am really going to enjoy doing in the future. Obviously there is a lot to learn yet, but I will play safe by only practising with new scripts when I have my Returnil program is switched on just in case I do something really silly.

I realised later that the reason the second script didn't work properly was because I did not save the notepad with quotes like you showed me to. I'm very grateful for you suggesting script to me and only wish I had known about it years ago.

Thanks again

#15 1up2down

1up2down
  • Topic Starter

  • Members
  • 284 posts
  • OFFLINE
  •  
  • Local time:03:54 PM

Posted 10 November 2010 - 02:35 PM

Actually, it does not have to be VBScript or JScript script file. You can also use a command script (batch file) file.
See here : http://www.trishtech.com/win7/run_a_script_at_shutdown_in_windows_7.php
Also : http://www.windows-help-central.com/windows-shutdown-script.html


Thanks, I like that first link you gave me, that's just what I was looking for.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users