Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with line in batch file

Posted on 2011-02-22
4
Medium Priority
?
450 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 85

Accepted Solution

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

782 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