I need to get access to my D: drive through command line to do certain
actions... I tried to do many things but it seems like it says
permission denied when changing the drive using ruby:
`d:`
What exactly did you do? And does the user have permissions on the
folder in question?
Kind regards
robert
···
On Wed, Nov 13, 2013 at 12:50 PM, Mario Ruiz <lists@ruby-forum.com> wrote:
I need to get access to my D: drive through command line to do certain
actions... I tried to do many things but it seems like it says
permission denied when changing the drive using ruby:
`d:`
Yes the user has permissions.
I need run a process going first to the folder so what i need to do is
from Ruby:
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
I'm not exactly sure what's going on here, but it sort of looks like Ruby
is trying to *run* `D:` in some way. At first I thought maybe the backtick
operator just assumed the first word was the name of an executable file,
but then I found out that you can do `cd /d D:` (`cd` is built in to
Windows's cmd.exe, not a separate file). Then I wondered if maybe cmd.exe
didn't accept `D:` on its command line, but--sure enough--`cmd /k D:` works
fine.
I also noticed the backtick operator only seems to read up to the first
newline. You have to use `&&` between the Windows commands. E.g.:
`cd /d D: && cd d:/myrootfolder/ && /folder1/myprocess.exe`
But I'm unclear as to why you don't use Ruby's Dir class methods to change
drives/directories.
···
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> wrote:
Of course not.. i was just explaining, what i do is like this more or
less:
`
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
`
Error:
Permission denied, even when doing just `D:`
so it seems it is not possible in ruby to select the drive in command
line
Yes the user has permissions.
I need run a process going first to the folder so what i need to do is
from Ruby:
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
This is done actually in a ruby thread
Certainly not - this isn't even valid Ruby code:
$ ruby -c <<CODE
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
CODE
-:1: syntax error, unexpected ':', expecting $end
So what did you _really_ do? And what error message did you get?
Cheers
robert
···
On Wed, Nov 13, 2013 at 4:15 PM, Mario Ruiz <lists@ruby-forum.com> wrote:
Of course not.. i was just explaining, what i do is like this more or
less:
`
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
`
Error:
Permission denied, even when doing just `D:`
so it seems it is not possible in ruby to select the drive in command
line
I'm not exactly sure what's going on here, but it sort of looks like Ruby is
trying to *run* `D:` in some way. At first I thought maybe the backtick
operator just assumed the first word was the name of an executable file, but
Yes, that's most likely what's happening. Ruby needs a program to
execute but "cd" is just an internal command of "cmd". It's probably
better to do something like
then I found out that you can do `cd /d D:` (`cd` is built in to Windows's
cmd.exe, not a separate file). Then I wondered if maybe cmd.exe didn't
accept `D:` on its command line, but--sure enough--`cmd /k D:` works fine.
I also noticed the backtick operator only seems to read up to the first
newline. You have to use `&&` between the Windows commands. E.g.:
`cd /d D: && cd d:/myrootfolder/ && /folder1/myprocess.exe`
"cd /d" can change drive and directory so only one "cd" is needed (see above).
But I'm unclear as to why you don't use Ruby's Dir class methods to change
drives/directories.
Same here.
Kind regards
robert
···
On Wed, Nov 13, 2013 at 9:15 PM, Eric Christopherson <echristopherson@gmail.com> wrote:
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> wrote:
Please forgive the brevity/spelling errors.
This message is being sent from my iPhone
To contact me by phone please
Call
Office.: 1-212-702-4027
Mobil 1-917-653-7887
Fax (Secure Fax, no cover letter needed) 1-917-265-4744
This email is private and confidential. Unauthorized use of private and confidential information is prohibited.
···
On Nov 13, 2013, at 3:15 PM, Eric Christopherson <echristopherson@gmail.com> wrote:
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> wrote:
Of course not.. i was just explaining, what i do is like this more or
less:
`
D:
cd d:/myrootfolder/
/folder1/myprocess.exe
`
Error:
Permission denied, even when doing just `D:`
so it seems it is not possible in ruby to select the drive in command
line
I'm not exactly sure what's going on here, but it sort of looks like Ruby is trying to *run* `D:` in some way. At first I thought maybe the backtick operator just assumed the first word was the name of an executable file, but then I found out that you can do `cd /d D:` (`cd` is built in to Windows's cmd.exe, not a separate file). Then I wondered if maybe cmd.exe didn't accept `D:` on its command line, but--sure enough--`cmd /k D:` works fine.
I also noticed the backtick operator only seems to read up to the first newline. You have to use `&&` between the Windows commands. E.g.:
`cd /d D: && cd d:/myrootfolder/ && /folder1/myprocess.exe`
But I'm unclear as to why you don't use Ruby's Dir class methods to change drives/directories.
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> > wrote:
Thanks Eric this worked!!!
I don't use the Dir class because it changes also then the Dir for the
execution of the current code that is in a Sinatra... so changes also
the references to libraries and everything...
I’m a bit unclear on the issues, but couldn’t you do this:
Dir.chdir("d:/myrootfolder/") do |rootfolder|
`/folder/myprocess.exe`
end
?
···
On Nov 14, 2013, at 4:12 AM, Mario Ruiz <lists@ruby-forum.com> wrote:
Eric Christopherson wrote in post #1127226:
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> >> wrote:
Thanks Eric this worked!!!
I don't use the Dir class because it changes also then the Dir for the
execution of the current code that is in a Sinatra... so changes also
the references to libraries and everything...
On Thu, Nov 14, 2013 at 11:12 AM, Mario Ruiz <lists@ruby-forum.com> wrote:
Eric Christopherson wrote in post #1127226:
On Wed, Nov 13, 2013 at 11:33 AM, Mario Ruiz <lists@ruby-forum.com> >> wrote:
Thanks Eric this worked!!!
I don't use the Dir class because it changes also then the Dir for the
execution of the current code that is in a Sinatra... so changes also
the references to libraries and everything...