Solved

quick dos batch to update files.

Posted on 2016-08-30
3
58 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
3 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 400 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 53

Assisted Solution

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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