?
Solved

quick dos batch to update files.

Posted on 2016-08-30
3
Medium Priority
?
90 Views
Last Modified: 2016-08-30
I need to a quick dos batch to accomplish the following:

1. if not exist \\server2\share\%username%\appdata\roaming\vlc
mkdir \\server2\share\%username%\appdata\roaming\vlc
copy \\server1\share\vlc\vlc-qt-interface.ini \\server2\share\%username%\appdata\roaming\vlc\vlc-qt-interface.ini /y

2. if exist \\server2\share\%username%\appdata\roaming\vlc
just copy \\server1\share\vlc\vlc-qt-interface.ini \\server2\share\%username%\appdata\roaming\vlc\vlc-qt-interface.ini /y and overwrite the existing file.  

Would some put it together with the right syntax?  

I do not mind if someone can suggest the PS version that does the same.  

Thanks.
0
Comment
Question by:nav2567
[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
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 1600 total points
ID: 41776988
set TargetDir=\\server2\share\%username%\appdata\roaming\vlc
if not exist "%TargetDir%" mkdir "%TargetDir%"
copy "\\server1\share\vlc\vlc-qt-interface.ini" "%TargetDir%\vlc-qt-interface.ini" /y

Open in new window

0
 
LVL 56

Assisted Solution

by:Bill Prew
Bill Prew earned 400 total points
ID: 41776989
I think this is what you are trying to doi:

@echo off
setlocal

set DestDir=\\server2\share\%username%\appdata\roaming\vlc
set IniFile=\\server1\share\vlc\vlc-qt-interface.ini

if not exist "%DestDir%" mkdir "%DestDir%"
copy /y "%IniFile%" "%DestDir%" >NUL

Open in new window

~bp
0
 

Author Closing Comment

by:nav2567
ID: 41777003
Thanks.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

801 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