Is there any universal way to redirect file operations to nul?

Microsoft Windows
Post Reply
Rekrul
Posts: 52
Joined: 2021-Aug-15, 11:29 pm

Is there any universal way to redirect file operations to nul?

Post by Rekrul »

You can redirect text and error output to nul, but is there any way to force operations that would normally write to a file, to write to nul instead?

I know you can do;

copy file.ext nul

But what about commands where you don't specify an output/destination filename, like archive programs? Many of them let you specify the path to extract the files to, but the actual filenames are whatever is contained within the archive file.

Is there any way that you can redirect all the file writes during an extract operation to nul, so that no files are written? Preferably a method that will work with other programs as well?
User avatar
Simon Sheppard
Posts: 191
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Is there any universal way to redirect file operations to nul?

Post by Simon Sheppard »

My first thought would be to create a RAM Disk and direct all writes to that, they are very fast and will be automatically wiped at next reboot, so perfect for temporary storage.
Writing to RAM avoids having a lot of read/writes to your SSD but at the cost of using some RAM.

In Windows 11 you will need something like Primo Ramdisk ($25), the days of the freebie vdisk.sys driver in MS-DOS are long gone.
https://www.romexsoftware.com/en-us/primo-ramdisk/

Testing software by installing it onto a RAM Disk, is a riot – everything is ridiculously fast.
Rekrul
Posts: 52
Joined: 2021-Aug-15, 11:29 pm

Re: Is there any universal way to redirect file operations to nul?

Post by Rekrul »

Simon Sheppard wrote: 2024-Feb-17, 10:05 am My first thought would be to create a RAM Disk and direct all writes to that, they are very fast and will be automatically wiped at next reboot, so perfect for temporary storage.
Writing to RAM avoids having a lot of read/writes to your SSD but at the cost of using some RAM.
OK, so there's no built in way to do it.
Simon_Weel
Posts: 36
Joined: 2021-Dec-13, 3:53 pm

Re: Is there any universal way to redirect file operations to nul?

Post by Simon_Weel »

I think it depends on the program you run? As soon as you start a program, cmd is no longer in control. That is, you can suppress the console output of a program (most of the times), but I don't think you can fiddle with any data operations the program performs.
Rekrul
Posts: 52
Joined: 2021-Aug-15, 11:29 pm

Re: Is there any universal way to redirect file operations to nul?

Post by Rekrul »

Simon_Weel wrote: 2024-Feb-22, 2:58 pm I think it depends on the program you run? As soon as you start a program, cmd is no longer in control. That is, you can suppress the console output of a program (most of the times), but I don't think you can fiddle with any data operations the program performs.
OK. I was just thinking that Windows might have some virtual device that could be used in place of a drive letter so that when the system directed file writes to it, they would just be discarded.

I did try Googling it, but of course all I got were pages talking about redircecting text output to Nul.

Thanks for replying.
Post Reply