Calling a file from within a script - file location (Full Version)

All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager



Message


xneilpetersonx -> Calling a file from within a script - file location (10/1/2008 5:44:14 PM)

Wow - I do have a ton of questions lately, I really do appreciate all of the help. I have been workign on this one for the better part of the day and am baffled.

I am putting together a front end for OSD. I have written a script that needs to call a txt file. I have placed both the script and the txt file inside of the scripts folder in my MDT Toolkit Package (oh yeah I'm using MDT as well). I assumed that the txt file would simply be found in the same folder that the script runs from and thus I could just call for the file with the file name and not a path. This apears to not be the case. I do have the option seleced to "Access Content directly from a DP when needed by the running tasl sequence".

Can anyone shed any light as to where this text file may be located at in this scenario? I have checked the DP folder and it is in fact present.

Thanks

neilp




skissinger -> RE: Calling a file from within a script - file location (10/1/2008 5:51:37 PM)

I use this:
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))

For example, if you wanted to copy a specific file located in the same dir as the .vbs script to c:\windows\system32:

On Error Resume Next
Set sho = Wscript.CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
Set strSysFolder = FSO.GetSpecialFolder(1) 'get system32 folder
'Copy the dll to the system folder
FSO.CopyFile strcurrentdir & "\certadm.dll",strSysFolder & "\"
wscript.quit




rbennett806 -> RE: Calling a file from within a script - file location (10/1/2008 6:14:05 PM)

Here's a snippet of VBScript code that I use...

strScriptFileDirectory = objFSO.GetParentFolderName(wscript.ScriptFullName)

If objFSO.FileExists (strScriptFileDirectory & "\iTunes.lnk") Then
   objFSO.CopyFile (strScriptFileDirectory & "\iTunes.lnk"), (strAllUsersProgramsPath & "\iTunes\iTunes.lnk"), True
End If


Just an example...




xneilpetersonx -> RE: Calling a file from within a script - file location (10/2/2008 12:54:42 AM)

Thanks you two - I've got it working well.

neilp




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.6484375