Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .