1

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?

2
  • 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, 2012 at 4:03
  • It is in an .ini file.
    – CJ7
    Dec 28, 2012 at 4:20

2 Answers 2

0

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

0

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.

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

You must log in to answer this question.

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