Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is a hostname to use in UNC paths that refers to the current machine in XP?

eg. \\localhost\share\file.txt

Except that localhost doesn't work. What will work?

share|improve this question
    
What application is your question for? A batch file? A script? Maybe we can help you out better with some more information? –  G Koe Dec 28 '12 at 4:03
    
It is in an .ini file. –  CJ7 Dec 28 '12 at 4:20

2 Answers 2

use the actual computername or \\127.0.0.1\share\file.txt

share|improve this answer

COMPUTERNAME is an environment variable that has the local computer's hostname. So \\%COMPUTERNAME%\Share will work provided the process is running on the local computer.

share|improve this answer
1  
Doesn't work. I don't think UNC paths can expand out environment variables like %COMPUTERNAME%. –  CJ7 Dec 28 '12 at 3:53
    
@CJ7 Ah, it works in Windows 7. I assumed it did in XP, too. Sorry about that. –  Bacon Bits Dec 28 '12 at 4:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.