Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 6th, 2007, 08:27 AM
0x90 0x90 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 3 0x90 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 13 m 51 sec
Reputation Power: 0
Exclamation Windows batch script: SET command as variable!

Hello,

how can I set a command as a variable in windows batch script?

this is the script //its just a test:

Code:
@ECHO off
SET /P userpass=Enter Password: 
::hash = 123
SET userhash=202CB962AC59075B964B07152D234B70
SET userpass1=%cd%md5.exe -d%userpass%

IF "%userhash%" == "%userpass1%" (	
	ECHO good
) ELSE (
	ECHO bad
)
goto :EOF


in linux it accept commands with variables:

Code:
#!/bin/sh
echo -n "Enter Password: "
read userpass
#hash = 123
userhash="ba1f2511fc30423bdbb183fe33f3dd0f"
userpass1=`echo "$userpass" | md5sum | awk '{print $1}'`

if [ "$userhash" == "$userpass1" ]; then
        echo "good"
else
        echo "bad"
fi



any idea
thanks,

Reply With Quote
  #2  
Old September 10th, 2007, 08:21 PM
bullet's Avatar
bullet bullet is offline
Java Junkie
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jan 2004
Location: Mobile, Alabama
Posts: 3,279 bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level)bullet User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 15 h 28 m 32 sec
Reputation Power: 309
Send a message via ICQ to bullet Send a message via AIM to bullet Send a message via MSN to bullet
Quote:
Originally Posted by 0x90
Hello,

how can I set a command as a variable in windows batch script?

this is the script //its just a test:

Code:
@ECHO off
SET /P userpass=Enter Password: 
::hash = 123
SET userhash=202CB962AC59075B964B07152D234B70
SET userpass1=%cd%md5.exe -d%userpass%

IF "%userhash%" == "%userpass1%" (	
	ECHO good
) ELSE (
	ECHO bad
)
goto :EOF


in linux it accept commands with variables:

Code:
#!/bin/sh
echo -n "Enter Password: "
read userpass
#hash = 123
userhash="ba1f2511fc30423bdbb183fe33f3dd0f"
userpass1=`echo "$userpass" | md5sum | awk '{print $1}'`

if [ "$userhash" == "$userpass1" ]; then
        echo "good"
else
        echo "bad"
fi



any idea
thanks,


Have you considered installing Perl on your machine?

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Windows batch script: SET command as variable ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT