Jump to content
Sign in to follow this  
Guest Ran

How to equate DOS variable in Autoit?

Recommended Posts

Guest Ran

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
GrahamS

$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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.