?
Solved

DOS Script for batch

Posted on 2013-01-10
14
Medium Priority
?
528 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
14 Comments
 

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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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 56

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
 
LVL 56

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 56

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 56

Accepted Solution

by:
Bill Prew earned 2000 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 56

Expert Comment

by:Bill Prew
ID: 38795618
Welcome.

~bp
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

800 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