daypro
asked on
vb6 how to copy file to system32 in win7 64bit
below vb6 code
'-----
Dim fs As New FileSystemObject
fs.CopyFile "c:\Test.TXT", "C:\Windows\SysWOW64\Test. txt"
fs.CopyFile "c:\Test.TXT", "C:\Windows\System32\Test. txt"
'-----
why fs.CopyFile "c:\Test.TXT", "C:\Windows\SysWOW64\Test. txt" can work
but fs.CopyFile "c:\Test.TXT", "C:\Windows\System32\Test. txt" can't work
which is to say
after execute program,in C:\Windows\SysWOW64 can find Test.txt
but C:\Windows\System32 can't find Test.txt
how vb6 copy file to Win7 64 bit c:\windows\system32\ directory ?
Thanks.
'-----
Dim fs As New FileSystemObject
fs.CopyFile "c:\Test.TXT", "C:\Windows\SysWOW64\Test.
fs.CopyFile "c:\Test.TXT", "C:\Windows\System32\Test.
'-----
why fs.CopyFile "c:\Test.TXT", "C:\Windows\SysWOW64\Test.
but fs.CopyFile "c:\Test.TXT", "C:\Windows\System32\Test.
which is to say
after execute program,in C:\Windows\SysWOW64 can find Test.txt
but C:\Windows\System32 can't find Test.txt
how vb6 copy file to Win7 64 bit c:\windows\system32\ directory ?
Thanks.
try executing the script from an elevated command prompt.
hope this helps.
hope this helps.
ASKER
thanks for the reply
1,I have tried run as administrator but not working
2 could suman_g4: give an example of how to elevated command prompt
thanks
1,I have tried run as administrator but not working
2 could suman_g4: give an example of how to elevated command prompt
thanks
suman_g4 meant --> go to start --> in the search box type cmd --> right click on the cmd icon and choose run as administrator
you will have the command line window --> type the command you want ( like this )
copy c:\Test.TXT C:\Windows\System32\Test.t xt
you will have the command line window --> type the command you want ( like this )
copy c:\Test.TXT C:\Windows\System32\Test.t
ASKER
thanks for the reply
in fact ,I want to use vb6 to make a install program
first step is copy four file uniime.dll,miniime.tpl,chi nese.ime,c hinese.tbl
to windows/system32 folder
in win7 32 bit the code
fs.CopyFile "c:\uniime.dll", "C:\Windows\System32\uniim e.dll" works ok
but in win7 64 bit after the same vb6 code
fs.CopyFile "c:\uniime.dlll", "C:\Windows\System32\uniim e.dll" or
fs.CopyFile "c:\test.txt", "C:\Windows\System32\test. txt"
i check C:\Windows\System32
still can't see uniime.dll or test.txt (even run as administraor)
but use command line window dos command
copy c:\uniime.dll C:\Windows\System32\uniime .dll
or copy c:\test.txt C:\Windows\System32\test.t xt
works ok
Try manual copy also works ok
Try below vb6 code
shell "cmd.exe /c copy c:\test.txt C:\Windows\System32\test.t xt"
not ok,
in windows/system32 can't see copy result,
--
is there any way to use vb6 code
to copy file to c:\windows\system32 folder in win7 64 bit
thanks.
in fact ,I want to use vb6 to make a install program
first step is copy four file uniime.dll,miniime.tpl,chi
to windows/system32 folder
in win7 32 bit the code
fs.CopyFile "c:\uniime.dll", "C:\Windows\System32\uniim
but in win7 64 bit after the same vb6 code
fs.CopyFile "c:\uniime.dlll", "C:\Windows\System32\uniim
fs.CopyFile "c:\test.txt", "C:\Windows\System32\test.
i check C:\Windows\System32
still can't see uniime.dll or test.txt (even run as administraor)
but use command line window dos command
copy c:\uniime.dll C:\Windows\System32\uniime
or copy c:\test.txt C:\Windows\System32\test.t
works ok
Try manual copy also works ok
Try below vb6 code
shell "cmd.exe /c copy c:\test.txt C:\Windows\System32\test.t
not ok,
in windows/system32 can't see copy result,
--
is there any way to use vb6 code
to copy file to c:\windows\system32 folder in win7 64 bit
thanks.
since vb6 is 32 bit, and running it will run in 32bit mode under a 64bit system, it will run in WOW64 mode.
that's why your application has only access to the SysWOW64.
but why do you need it to reside in System32 Instead, you could access it from SysWOW64 directly.
maybe im missing something, please correct me.
that's why your application has only access to the SysWOW64.
but why do you need it to reside in System32 Instead, you could access it from SysWOW64 directly.
maybe im missing something, please correct me.
if you want instead, you can run an api to get the system32 of the operating system
so when you run the application, it will automatically check the system32 folder for you.
in a 32bit OS it will return System32, in a 64OS it will return Sys64WOW
and as i told you before, your application is 32bit, so you should not worry about the folder, all what you need is the system folder returned by the OS.
do you want me to provide you with the code?
so when you run the application, it will automatically check the system32 folder for you.
in a 32bit OS it will return System32, in a 64OS it will return Sys64WOW
and as i told you before, your application is 32bit, so you should not worry about the folder, all what you need is the system folder returned by the OS.
do you want me to provide you with the code?
ASKER
thanks OHDev2004 help,
my application install to win7 64 bit need to copy to both folder(syswow64 and system32)
then it can run correctly,
if I only copy to syswow64,(in 32 bit program like word 2003 run ok .but 64 bit program like notepad can not run my chaine input ime program)
now if i can copy file to system32 in win7 64 bit ,
then I can success finish my install ime program both compatible 32bit application(like word 2003)
and 64 bit application(like notepad) in win7 64bit
so is there any solution to copy file to system32 folder in win7 64 bit use vb6 32bit program?
also I need OHDev2004 provide me the code of
system folder returned by the OS,
thanks ,all the best
my application install to win7 64 bit need to copy to both folder(syswow64 and system32)
then it can run correctly,
if I only copy to syswow64,(in 32 bit program like word 2003 run ok .but 64 bit program like notepad can not run my chaine input ime program)
now if i can copy file to system32 in win7 64 bit ,
then I can success finish my install ime program both compatible 32bit application(like word 2003)
and 64 bit application(like notepad) in win7 64bit
so is there any solution to copy file to system32 folder in win7 64 bit use vb6 32bit program?
also I need OHDev2004 provide me the code of
system folder returned by the OS,
thanks ,all the best
ASKER
correct :chaine type wrong(chinese)
chaine input ime program
is chinese input ime prgram
chaine input ime program
is chinese input ime prgram
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks OHDdev2004's Code,
I have tested and success copy file to system32 in win7 64 bit
it's really perfect solution
I have tested and success copy file to system32 in win7 64 bit
it's really perfect solution
your welcome, glad it helped out.
just be sure to turn the restriction Back on like in the sample, because this is system wide,
and any 32bit application will be affected.
have a nice day!
just be sure to turn the restriction Back on like in the sample, because this is system wide,
and any 32bit application will be affected.
have a nice day!
ASKER
ok,I will turn the restriction Back on (don't affect another 32 bit application)
thanks again
all the best
thanks again
all the best
Try make your project executable for example test.exe
then right click on it ( or Shift + right click ) then choose run as administrator , and see if it going to be copied to system32 or not