Jump to content

[ SOLVED ] C:\WINDOWS\system32 - what if it isn't ( C:\ )

Recommended Posts

Hello community.

I am on winxp and my drive letter is C:\ so i call something like this ie.

Global $Init_Dir = "C:\"


If WinActive("C:\WINDOWS\system32\regedit.exe") Then

But if a user has some other drive letter ie. (E:\) how to make the script run correctly if i make it on my pc that has (C:\).

stupid or not quest. i appreciate your advice.

Thank you

Edited by armoros

[font="verdana, geneva, sans-serif"] [/font]

Link to post
Share on other sites

Change WinTitleMatchMode() to accept a StringInStr type searching, and just omit the drive letter?

Scratch that... stupid hackaround.

@SystemDir returns "C:\Windows\System32\"

@WindowsDir returns "C:WINDOWS"

It should report the drive correctly if windows is installed on another drive letter.

If WinActive(@SystemDir & "regedit.exe") Then [...]
Edited by mechaflash213

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”


Link to post
Share on other sites

I'm only new to AutoIt, but I do know that running %systemroot% in windows opens the Windows folder regardless of drive letter...

Perhaps there's an equivalent, then you'd just need to do & "system32"

Edit: Ah, sorry, didn't see the edit.

Edited by BlueLED
Link to post
Share on other sites

It's all been said already, but for completeness sake.

; Changes how literal strings and % symbols are interpreted. By default strings are treated literally,
; this option allows you to use %environment% variables inside strings, e.g., "The temp directory is: %temp%".
Opt("ExpandEnvStrings", 1) ; 1 = expand environment variables

; If the system is located on drive D: the results are as stated in the comment.
ConsoleWrite(@SystemDir & @LF) ; D:WINDOWSsystem32
ConsoleWrite(@HomeDrive & @LF) ; D:
ConsoleWrite(EnvGet("systemdrive") & @LF) ; D:
ConsoleWrite("%systemdrive%" & @LF) ; D:
ConsoleWrite("%homedrive%" & @LF) ; D:

Edit: added use of ExpandEnvStrings.

Edited by Robjong
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...