Windows spawn program
-
I've been playing around with the spawn command and found some interesting things. I'm setup as a regular user on Windows 10 and using SU 2016
I can easily start an external Windows program such as cutmaster.exe using the spawn command providing it is not installed in program files
filename = File.join('c:', 'program files (x86)', 'cutmaster', 'cutmaster.exe')File.file?(filename) returns true and yes the file exists
spawn(filename) gives me the error 'No such File or Directory'If I install the program somewhere else then it spawns.
However, if I use the old DOS subst command then it will spawn just fine.subst y: 'c:\program files (x86)\cutmaster'
I've tried to run the subst command from within ruby but can't seem to do it.
cmd = 'subst'
drive = 'c:'
folder = File.join('c:', 'program files (x86)', 'cutmaster')
#{cmd} #{drive} "#{folder}"Has anyone any success doing this sort of thing?
-
Try something like:
cmd = "\"#{filename}\"" spawn(cmd)
It needs enclosing"", since the string contains spaces...
Wherefilenameneeds to be the full path to the exe file. -
Of course !! Thanks Tig
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement