View Full Version : System32 folder
fflei
03-17-2006, 07:00 AM
I have made a little exe file which replaces missing or corrupted files necessary to run 16-bit programs. Here's what I've got for the OnClick Script for the button -
result = File.Install("AutoPlay\\Docs\\AUTOEXEC.NT", "C:\\Windows\\System32\\AUTOEXEC.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\command.com", "C:\\Windows\\System32\\command.com", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\CONFIG.NT", "C:\\Windows\\System32\\CONFIG.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
Page.Jump("Page2");
it works, but only if their System32 folder really is in C:\Windows\System32.... please can someone tell me how to make AM6 find the folder and put the file in it if the path is something else?
Fflei
Hi
change your code to;
-- _WindowsFolder is a global variable (The path to the user’s Windows folder (e.g. "C:\Windows")).
result = File.Install("AutoPlay\\Docs\\AUTOEXEC.NT", _WindowsFolder.."\\System32\\AUTOEXEC.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\command.com", _WindowsFolder.."\\System32\\command.com", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\CONFIG.NT", _WindowsFolder.."\\System32\\CONFIG.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
Page.Jump("Page2");
fflei
03-17-2006, 07:13 AM
Mina, you are a star!
Thank you!:yes :yes :yes :yes
Fflei
rhosk
03-17-2006, 07:21 AM
FWIW, you could also use the system folder global -
result = File.Install("AutoPlay\\Docs\\AUTOEXEC.NT", _SystemFolder.."\\AUTOEXEC.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\command.com", _SystemFolder.."\\command.com", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\CONFIG.NT", _SystemFolder.."\\CONFIG.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
Page.Jump("Page2");
Careful!!! Some older windows environments like win98 used "Windows\System" instead of "Windows\System32"
Try the _SystemFolder global instead of the _WindowsFolder to be safe.
-- _SystemFolder is a global variable (The path to the user’s Windows System folder (e.g. "C:\Windows\System")).
result = File.Install("AutoPlay\\Docs\\AUTOEXEC.NT", _SystemFolder.."\\AUTOEXEC.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\command.com", _SystemFolder.."\\command.com", FILE_INSTALL_ALWAYS, true, true, nil, nil);
result = File.Install("AutoPlay\\Docs\\CONFIG.NT", _SystemFolder.."\\CONFIG.NT", FILE_INSTALL_ALWAYS, true, true, nil, nil);
Page.Jump("Page2");
i forgot about the System Folder global. it's definitely safer than the Windows Folder global :yes
fflei
03-17-2006, 07:51 AM
Thank you everyone for your speedy solutions - having used Mina's first code first, I've now changed it to the latest suggested version.
Fflei
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.