Solved

Help with line in batch file

Posted on 2011-02-22
4
428 Views
Last Modified: 2012-05-11
I need a quick hand with a line in a batch file

If %Source% == %Destin% %Destin% = %Destin%+".000"

It isn't working as intended.

It should (in my mind anyway) compare the two variables. If the two match, the Destin variable should have .000 appended.
e.g. JSmith becomes Jsmith.000

Thanks

Aidan
0
Comment
Question by:aideb
4 Comments
 
LVL 7

Expert Comment

by:David_Hagerman
ID: 34950744
Have you tried putting your second argument on a second line

If %Source% == %Destin%
%Destin% = %Destin%+".000
0
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 34950785
Try
if /i "%Source%"=="%Destin%" set Destin=%Destin%.000

Open in new window

0
 
LVL 2

Author Closing Comment

by:aideb
ID: 34950823
Result!

Thanks
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34950828
Example

set Source=234
set Destin=234

If NOT "%Source%"=="%Destin%" GOTO NextStep
Set Destin=%Destin%.000
:NextStep
echo %Destin%

Open in new window

0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This article runs through the process of deploying a single EXE application selectively to a group of user.
In-place Upgrading Dirsync to Azure AD Connect
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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 …

821 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