Link to home
Start Free TrialLog in
Avatar of AXISHK
AXISHK

asked on

DOS Script for batch

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
Avatar of Kotteeswaran Rajendran
Kotteeswaran Rajendran
Flag of Malaysia image

Avatar of AXISHK
AXISHK

ASKER

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

Tks
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/
Avatar of AXISHK

ASKER

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
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
Avatar of AXISHK

ASKER

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
Avatar of AXISHK

ASKER

I've requested that this question be deleted for the following reason:

No further feedback.
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
Avatar of AXISHK

ASKER

Return with Invalid Syntax. Mandaytory otpion '/sc' is missing.

Any idea ?

Tks
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
Avatar of AXISHK

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AXISHK

ASKER

Tks
Welcome.

~bp