Executing ls command from a batch file

FAQ, getting help, user experience about Primo Ramdisk
Post Reply
PhilRack
Posts: 5
Joined: Fri May 11, 2012 2:50 pm

Executing ls command from a batch file

Post by PhilRack » Thu Nov 21, 2019 2:33 am

I'm struggling with trying to execute the ls command from a CMD file to run as a batch job. Specifically, I'm trying to direct output to a text file.
This is on Windows 10 Pro. Here's what I've been trying but to no avail.

@ECHO ON
CLS
SETLOCAL ENABLEEXTENSIONS

"C:\Program Files\Primo Ramdisk\rxprd.exe" ls > c:\temp\myfileinfo.txt

Pause
EXIT

Any suggestions would be welcomed! Note, I can manually open a command window and run the command rxprd.exe > c:\temp\myfileinfo.txt and it works fine.

Phil

User avatar
support
Posts: 2532
Joined: Sun Dec 21, 2008 2:42 am

Re: Executing ls command from a batch file

Post by support » Fri Nov 22, 2019 4:47 am

You need to run the batch file with administrative privileges. The easiest way is to create a shortcut on this batch file, and then right click the shortcut file, choose "Properties", then "Shortcut" - "Advanced...", and then check the option "Run as administrator".
Primo Ramdisk | PrimoCache
Romex Software Support

PhilRack
Posts: 5
Joined: Fri May 11, 2012 2:50 pm

Re: Executing ls command from a batch file

Post by PhilRack » Thu Nov 28, 2019 5:39 pm

Thanks. I also discovered another issue. And that is I have to change to the current drive and issue a CD command before executing the rxprd.exe xxx command.

@ECHO ON
CLS
SETLOCAL ENABLEEXTENSIONS

C:
CD\
"C:\Program Files\Primo Ramdisk\rxprd.exe" ver > D:\WPSWORK\_TD29980\vdriveversion.txt
EXIT

p.s. This is absolutely great software! I love your products.

User avatar
support
Posts: 2532
Joined: Sun Dec 21, 2008 2:42 am

Re: Executing ls command from a batch file

Post by support » Fri Nov 29, 2019 5:06 am

PhilRack wrote:
Thu Nov 28, 2019 5:39 pm
I have to change to the current drive and issue a CD command before executing the rxprd.exe xxx command.
I checked again and don't see these steps are required before executing rxprd.exe. Perhaps some other things caused this issue?
Primo Ramdisk | PrimoCache
Romex Software Support

Post Reply