关于开机启动一个文件 我写了一个vbs的文件 我想在这个文件里加些代码 让它实现开机的时候自己启动 能实现吗 如果能请问代码该怎么鞋呢 ?急求 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Dim StrTheFileDim ObjFSODim ObjWSDim StrStartUpFolderSet ObjWS = CreateObject("Wscript.Shell")Set ObjFSO = CreateObject("Scripting.FileSystemObject")StrTheFile = wscript.ScriptFullName '当前文件路径StrStartUpFolder = ObjWS.SpecialFolders("AllUsersStartup")Set ObjShellLink = ObjWS.CreateShortcut(StrStartUpFolder & "\Vbs.lnk")With ObjShellLink .TargetPath = StrTheFile .WindowStyle = 1 .IconLocation = "notepad.exe, 0" .Description = "ShortCut" .WorkingDirectory = StrStartUpFolder .SaveEnd With 请问上边的代码里我要把我的vbs文件写到什么地方啊 我还以为来错版了……给你一个创建快捷方式的函数://创建快捷方式函数BOOL CRosePojieDlg::CreateDesktopShotCut( CString strName, CString strSourcePath ){ if(FAILED(CoInitialize(NULL))) { return FALSE; } int i; char Path[MAX_PATH+1]; CString strDestDir; i=CSIDL_DESKTOPDIRECTORY; LPITEMIDLIST pidl; LPMALLOC pShell; if(SUCCEEDED(SHGetMalloc(&pShell))) { if(SUCCEEDED(SHGetSpecialFolderLocation(NULL,i,&pidl))) { if(!SHGetPathFromIDList(pidl,Path)) { pShell->Free(pidl); ::CoUninitialize(); return FALSE; } pShell->Release(); strDestDir.Format("%s",Path); strDestDir+="\\"; strDestDir+=strName; strDestDir+=".lnk"; IShellLink* psl; if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&psl))) { psl->SetPath(strSourcePath); IPersistFile* ppf; if(SUCCEEDED(psl->QueryInterface(IID_IPersistFile,(LPVOID*)&ppf))) { WCHAR wsz[MAX_PATH]; MultiByteToWideChar(CP_THREAD_ACP,MB_PRECOMPOSED,strDestDir,-1,wsz,MAX_PATH); if(SUCCEEDED(ppf->Save(wsz,TRUE))) { ppf->Release(); psl->Release(); ::CoUninitialize(); return TRUE; }else { ppf->Release(); psl->Release(); ::CoUninitialize(); return FALSE; } }else { ppf->Release(); psl->Release(); ::CoUninitialize(); return FALSE; } }else { ::CoUninitialize(); return FALSE; } }else { ::CoUninitialize(); return FALSE; } }else { ::CoUninitialize(); return FALSE; }} 哦,想“在”vbs代码里面创建自身快捷方式并实现自启动,还是想在C++代码中创建这个vbs文件的快捷方式并实现自启动? 给你的代码不正是为本vbs在启动文件夹创建快捷方式么 codeblocks使用 请问更换MFC程序的图标 onButton创建在全局实现的线程:error 求助!D3DXMatrixRotationAxis对应的数学公式是什么? 字符指针数组的问题 专门查看木马隐身地方的软件!!要的留邮箱:) 很弱智的问题,散分! 关于存储过程使用varchar2型参数的问题?(帮助有分) 关于CEdit的文字换行的问题。 如何在IWebBrowser内部进行拖操作,就是自己拖放自己接收。然后打开这个连接 c++类与对象 多线程问题
Dim StrTheFile
Dim ObjFSO
Dim ObjWS
Dim StrStartUpFolderSet ObjWS = CreateObject("Wscript.Shell")
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
StrTheFile = wscript.ScriptFullName '当前文件路径
StrStartUpFolder = ObjWS.SpecialFolders("AllUsersStartup")Set ObjShellLink = ObjWS.CreateShortcut(StrStartUpFolder & "\Vbs.lnk")
With ObjShellLink
.TargetPath = StrTheFile
.WindowStyle = 1
.IconLocation = "notepad.exe, 0"
.Description = "ShortCut"
.WorkingDirectory = StrStartUpFolder
.Save
End With
{
if(FAILED(CoInitialize(NULL)))
{
return FALSE;
}
int i;
char Path[MAX_PATH+1];
CString strDestDir;
i=CSIDL_DESKTOPDIRECTORY;
LPITEMIDLIST pidl;
LPMALLOC pShell;
if(SUCCEEDED(SHGetMalloc(&pShell)))
{
if(SUCCEEDED(SHGetSpecialFolderLocation(NULL,i,&pidl)))
{
if(!SHGetPathFromIDList(pidl,Path))
{
pShell->Free(pidl);
::CoUninitialize();
return FALSE;
}
pShell->Release();
strDestDir.Format("%s",Path);
strDestDir+="\\";
strDestDir+=strName;
strDestDir+=".lnk";
IShellLink* psl;
if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&psl)))
{
psl->SetPath(strSourcePath);
IPersistFile* ppf;
if(SUCCEEDED(psl->QueryInterface(IID_IPersistFile,(LPVOID*)&ppf)))
{
WCHAR wsz[MAX_PATH];
MultiByteToWideChar(CP_THREAD_ACP,MB_PRECOMPOSED,strDestDir,-1,wsz,MAX_PATH);
if(SUCCEEDED(ppf->Save(wsz,TRUE)))
{
ppf->Release();
psl->Release();
::CoUninitialize();
return TRUE;
}else
{
ppf->Release();
psl->Release();
::CoUninitialize();
return FALSE;
}
}else
{
ppf->Release();
psl->Release();
::CoUninitialize();
return FALSE;
}
}else
{
::CoUninitialize();
return FALSE;
}
}else
{
::CoUninitialize();
return FALSE;
}
}else
{
::CoUninitialize();
return FALSE;
}
}