Sign in to follow this  
Followers 0
Guest Ran

How to equate DOS variable in Autoit?

3 posts in this topic

Hi All,

In DOS batch file, I used this command ,

rem Win2K/XP

if %SystemDrive%==C: goto C_Drive

if %SystemDrive%==D: goto D_Drive

rem Win9x

if %windir% == C:\WINDOWS

if %windir% == D:\WINDOWS

How to do this in Autoit?

Thanks

Ran

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$systemdir = EnvGet("SystemDrive")

select
    case $systemdir == "C:"
        MsgBox(0,"", "System Dir is C:")

    case $systemdir == "D:"
        MsgBox(0,"", "System Dir is D:")

    case else
        MsgBox(0,"", "Unknown - " & $systemdir)
EndSelect

If you're needs are simple then you could just use

if $systemdir == "C:" then ... endif
instead of the select statement

EDIT: The above is valid AutoIt 3 code - worth upgrading?

Edited by GrahamS

GrahamS

Share this post


Link to post
Share on other sites

Hi everyone,

Thanks for the help. I manage to get it work.

Ran

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0