Solved

DOS Script for batch

Posted on 2013-01-10
14
517 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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 53

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 53

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 53

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 53

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 53

Expert Comment

by:Bill Prew
ID: 38795618
Welcome.

~bp
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
BAT FILE ERROR LOG Question 17 61
Build VS2015 project in bat command 3 87
question about windows batch/script 3 60
how to pick only current date files from a ftp 14 61
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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