コンピューターのユーザー フォルダー名を取得し、それをパス (この場合はスタートアップ パスとデスクトップ パス) に入れる必要があります。ユーザーフォルダー名を見つける方法を見つけましたが、それをパスに入れる方法を考え出すことに固執しています。誰でも方法を知っていますか?
Set WshShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
それは大きな助けになるでしょう。
編集
Set objShell = Wscript.CreateObject("Wscript.Shell")
strPath = objShell.SpecialFolders("Startup")
wscript.echo strPath
dim WSHShell, desktop, pathstring, startup, objFSO
set objFSO=CreateObject("Scripting.FileSystemObject")
Set WSHshell = CreateObject("WScript.Shell")
desktop = WSHShell.SpecialFolders("Desktop")
pathstring = objFSO.GetAbsolutePathName(desktop)
WScript.Echo desktop
set filesys=CreateObject("Scripting.FileSystemObject")
filesys.CopyFile "desktop", dolpis.vbs,"startup", dolpis.vbs
set objFso=createObject("scripting.fileSystemObject")
set objWShell=wScript.createObject("WScript.Shell")
usrName=objWShell.expandEnvironmentStrings("%USERNAME%")
if objFso.folderExists(strFolder) then
objFso.copyFile strFileToCopy,strFolder&"\",True
else
msgbox "The folder " & strFolder & " does not exist"
end if
CreateObject("WScript.Shell").Run("C:\WINNT\system32\notepad.exe")
Set wshshell = wscript.CreateObject("WScript.Shell")
11 行目に「必要なオブジェクト: Dolpis」と記載されています。