Page 1 of 1

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

Posted: 2024-Feb-17, 8:53 am
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?

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

Posted: 2024-Feb-17, 10:05 am
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.

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

Posted: 2024-Feb-18, 2:34 am
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.

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

Posted: 2024-Feb-22, 2:58 pm
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.

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

Posted: 2024-Mar-05, 11:10 pm
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.