
[已解決]求教如何用批處理把%AllUsersProfile%里面的某個文件加入注冊表最后由 solan 于 -4-14 09:47如題,要求加入注冊表后是絕對路徑,不是相對路徑,因為我是想讓它跟隨系統(tǒng)的,而系統(tǒng)有可能安裝在c盤D盤或其它盤,我現(xiàn)在想到兩種方法,但都不能如愿,我先說說我的方法,然后求各位好心人幫我看看,我該怎么做?方法一:寫批處理代碼:
執(zhí)行該批處理后所得注冊表文件內(nèi)容為nclick="copycode($('code0'));">復制代碼
- @echo off
- echo Windows Registry Editor Version 5.00 >%AllUsersProfile%nx_flexrouter.reg
- echo [HKEY_CLASSES_ROOTUGpartfileshellopencommand] >>%AllUsersProfile%nx_flexrouter.reg
- cd /d %AllUsersProfile%
- echo @=%AllUsersProfile%nx_flexugs_router.exe -ug -use_file_dir %%1 >>%AllUsersProfile%nx_flexrouter.reg
- reg import %AllUsersProfile%nx_flexrouter.reg
- pause
在C:ProgramData里面少了個所以不能注冊,我不知道怎么讓批處理自動加上這個方法二:寫批處理代碼:nclick="copycode($('code1'));">復制代碼
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOTUGpartfileshellopencommand]
- @=C:ProgramDatanx_flexugs_router.exe -ug -use_file_dir %1
這回執(zhí)行該批處理后,能加入注冊表了,但是注冊表的數(shù)值數(shù)據(jù)里面少了個引號如下:C:ProgramDatanx_flexugs_router.exe -ug -use_file_dir %1 就是C:盤符后面少了個,所以ugs_router.exe不能執(zhí)行,也就是UG文件不能雙擊打開,如果是這樣就好了C:ProgramDatanx_flexugs_router.exe -ug -use_file_dir %1請好心人幫忙啊,我好著急哦。nclick="copycode($('code2'));">復制代碼
- @echo off
- reg add HKEY_CLASSES_ROOTUGpartfileshellopencommand /f /v /t REG_SZ /d %AllUsersProfile%nx_flexugs_router.exe -ug -use_file_dir %%1
- pause

