2

OK, this question has been asked before (e.g. Is there a /dev/null on Windows?) but I'm trying to find an answer that works, and all of the prior questions just say "change the command to point to NUL"

If I have a curl request (or whatever) which someone ran on a Unix/Mac which includes this:

-o /dev/null

it will throw an error if I try to run it as-is on my Windows box. Therefore, I need to change the command by replacing that with:

-o NUL

My question is, is there something I can do so that I can run the original curl request without needing to make that change?

IOW, can I create a symlink or something similar, so that I don't need to change the curl statement? Basically so I can use the *nix syntax on a Windows box?

Before someone says "how much hassle is it to change the curl", I'm running hundreds of curls a day, often ones which were originally run on a *nix box. Also, if I change to use Windows syntax, then when someone tries to run it on a *nix box, they get issues....

roryhewitt
  • 4,097
  • 3
  • 27
  • 33
  • In Windows, a filesystem symlink isn't allowed to target a character device. (I know in Unix "/dev/null" is a block device and that Unix symlinks aren't limited to disk and filesystem devices.) Even if it could, you'd have to create the link in a "\dev" directory on every drive, if the drive even support symlinks. – Eryk Sun Apr 30 '19 at 22:38
  • FYI, the root mountpoint for devices is "\\.\" or "\\?\", which get mapped to the NT device mountpoint "\??\", which consists of a local (per logon-session) directory that shadows the global mountpoint directory, "\Global??". Typically "nul" isn't locally shadowed, so "nul" [DOS] -> "\\.\nul" [Windows] -> "\??\nul" [NT] -> "\Global??\nul" [NT]. The latter is an object symlink to the real NT device name, "\Device\Null". – Eryk Sun Apr 30 '19 at 22:40
  • @eryksun I'll be honest, I didn't completely understand your response (my issue, not yours). LSS, what I want can't be done, it sounds like? – roryhewitt May 01 '19 at 00:14
  • I don't see a way to support "/dev/null" using a regular symlink. The I/O manager will fail the path reparse if it sees the target isn't a local (or remote if enabled) disk or filesystem device. I think it's possible with a filesystem filter driver, but I don't think anyone has developed one that allows creating virtual files such as a "/dev/null" file on every volume. – Eryk Sun May 01 '19 at 00:27

0 Answers0