Solved

DOS Script for batch

Posted on 2013-01-10
14
512 Views
Last Modified: 2013-01-18
Need to deploy a backup script to many workstations such that they could schedule to backup the chrome file , which is located under

From (local) : %userprofile%\Local Settings\Application Data\Google\Chrome\User Data\Default

To : U: (mounted drive)


Is it possible put deploy a script such that when a user double click on it, it will be scheduled on their Window XP or Window 7 and backup daily at night ?

Tks
0
Comment
Question by:AXISHK
  • 7
  • 5
  • 2
14 Comments
 
LVL 13

Expert Comment

by:imkottees
ID: 38765647
0
 

Author Comment

by:AXISHK
ID: 38765650
Thanks. but we want to deploy a batch file to automate it, rather than asking user to do this by themselves. Any advise ?

Tks
0
 
LVL 13

Expert Comment

by:imkottees
ID: 38765663
the article says how to schedule a task, no user interaction needed.. you can set the time and what to run.. it will run automatically, make sure machine is up by the time

to push batch file through gpo:
http://www.jasonpearce.com/blog/2010/11/17/deploy-software-via-group-policys-scheduled-tasks/

I.E: http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/
0
 

Author Comment

by:AXISHK
ID: 38765669
Understand but the users will not go through these steps by themselves... need the most easiest way such that a user just doube click on the file and schedule the backup task on the Window system...

Tks
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38765715
In the BAT file you can use SCHTASKS to schedule the execution daily. What do you want to execute?

http://ss64.com/nt/schtasks.html

~bp
0
 

Author Comment

by:AXISHK
ID: 38765782
Want to copy the following source folder to our network drive U which is mounted to the user's personal file.

The sript need to identify the environment variable - %userprofile%
 
From (local) : %userprofile%\Local Settings\Application Data\Google\Chrome\User Data\Default

To : U: (mounted drive)

Tks
0
 

Author Comment

by:AXISHK
ID: 38795440
I've requested that this question be deleted for the following reason:

No further feedback.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 51

Expert Comment

by:Bill Prew
ID: 38782440
Try using the following BAT file.  It will schedule a job that just executes XCOPY.EXE to copy the users files. You may want/need to adjust some of the XCOPY command options, or the SCHTASKS options. I tried to show an example that runs every day at 18:00 hours (6:00 pm).

(Notice that SCHTASKS requires embeded double quotes in the command line that you want to schedule to be escaped with a backslash.)

@echo off
schtasks /create /tn "Nightly Usewr Backup" /tr "xcopy \"%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\" \"U:\\" /s /i" /sc daily /st 18:00

Open in new window

~bp
0
 

Author Comment

by:AXISHK
ID: 38790313
Return with Invalid Syntax. Mandaytory otpion '/sc' is missing.

Any idea ?

Tks
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38790367
Sorry, forgot that "\" has to be escaped to "\\", so this will work:

@echo off
schtasks /create /tn "Nightly Usewr Backup" /tr "xcopy \"%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\" \"U:\\\" /s /i" /sc daily /st 18:00

Open in new window

~bp
0
 

Author Comment

by:AXISHK
ID: 38790443
After breaking the long command, I see a additional "\" between the xcopy ? Any idea ? Is that correct ?

"xcopy \"
%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\
" \"
U:\\\
" /s /i" /sc daily /st 18:00



2 mininal issues.

1. is it possible to execute the batch remotely from the server as it asked for the password, normal users don't have that right ?

2. Is it possible to remotely start the Task Scheduler service ?

If no, I will mark the question and try to post the question in another topic.

Tks again.
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38794230
The SCHTASKS command I posted last had correct format, I tried it here and it worked without error, adding a scheduled task.

There are some add on tools that can allow remote execution of a BAT file on another machine, but they come with some other tricky setup and limitations.  PSEXEC is one of these, at http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx.

~bp
0
 

Author Closing Comment

by:AXISHK
ID: 38795441
Tks
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 38795618
Welcome.

~bp
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now