myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


Calling a file from within a script - file location

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager >> Calling a file from within a script - file location Page: [1]
Login
Message << Older Topic   Newer Topic >>
Calling a file from within a script - file location - 10/1/2008 5:44:14 PM   
xneilpetersonx

 

Posts: 154
Score: 1
Joined: 7/18/2006
Status: offline
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
Post #: 1
RE: Calling a file from within a script - file location - 10/1/2008 5:51:37 PM   
skissinger


Posts: 2114
Score: 134
Joined: 9/13/2001
From: Sherry Kissinger
Status: offline
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


_____________________________

mofmaster@smsexpert.com (version 2007) | http://www.smsexpert.com | http://www.sccmexpert.com
My Blog
Microsoft MVP - ConfigMgr

(in reply to xneilpetersonx)
Post #: 2
RE: Calling a file from within a script - file location - 10/1/2008 6:14:05 PM   
rbennett806


Posts: 825
Score: 13
Joined: 6/14/2006
Status: offline
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...

(in reply to skissinger)
Post #: 3
RE: Calling a file from within a script - file location - 10/2/2008 12:54:42 AM   
xneilpetersonx

 

Posts: 154
Score: 1
Joined: 7/18/2006
Status: offline
Thanks you two - I've got it working well.

neilp

(in reply to rbennett806)
Post #: 4
Page:   [1]
All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager >> Calling a file from within a script - file location Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.299