Equivalent to Unix /dev/null for Windows (need black hole for output)

Posted on 2004-04-10
Last Modified: 2009-07-29
In Unix scripts and C programs, you can redirect output or write to a special file called "/dev/null".  This is useful if you need to write to a file, don't want the output, and don't want to actually create a temporary file and delete it later.

Below is the line of code I wish would work (it does not work):

DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, "/dev/null", False

...where /dev/null is normally a valid file name.

What is the Windows equivalent to Unix's /dev/null?

Question by:geekboysteves
  • 3
  • 3
LVL 17

Expert Comment

ID: 10797721
>> What is the Windows equivalent to Unix's /dev/null?

Possibly XP's "Null Device Driver". On Win9x, there may be a null port you can add for devices/hardware.

Author Comment

ID: 10797749
Thanks but I need more detail.  This is the full content of the link you provided:
Microsoft Windows XP Embedded  
Null Device Driver
The Null Device Driver component provides the functional equivalent of \dev\null in the Unix environment by accepting I/O request packets and returning them to the caller.

There are no services for this component.

Associated Components
No other components interact with this component.

There are no configurable settings for this component.
 Last updated on Friday, August 29, 2003
Not much to go on!
Thanks though.
LVL 17

Expert Comment

ID: 10797891
You'll probably have to install one yourself if one doesn't already exist. I don't have any experience with such so I'm not sure if this will apply to your scenario or not but it seems to be the equivalent to /dev/null on *nix platforms.

"Installing a Null Driver"
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.


Author Comment

ID: 10797898
I assumed there was something built-in.  I need something I can rely on on any Windows computer.  Isn't there something like PRN: and AUX: from the old DOS days?  Wasn't there a NUL: ?


c:> echo This text will print > PRN:
c:> echo This text is going nowhere > NUL:


LVL 17

Accepted Solution

zzzzzooc earned 125 total points
ID: 10797948
Those should still apply for Win9x/Win2k/WinXP if you can apply them to your scenario.

C:\>echo "Test" > nul

^^ Shouldn't output anywhere. Not sure if " " will work on Win9x though. I just checked with FileMon and there's nothing being written to disk with that.

Author Comment

ID: 10797996


That's it!  I knew it was something like that.  I tried it* on NT4, Windows Server 2003, Windows XP Home and Windows 2000 Server and it works just as /dev/null does under Unix.


* it = echo aaaaaaaaaaaaaaaa > nul

Did not create a file named "nul" and did not display any aaaaaaaaaaaaaaaaaa's or an error.

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now