![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | External File - Lookup Table In my script, i used a switch statement. Is there a way that the script points to a external file and get the values from external files ? Eg External_file.txt 1 good 2 bad 3 neutral Is there similar thing like #include <external_file.txt>, and the powershell loads the value from external files ? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: External File - Lookup Table On Oct 23, 10:26*pm, "IT Staff" <jkk...@xxxxxx> wrote: Quote: > In my script, i used a switch statement. > > Is there a way that the script points to a external file and get the values > from external files ? > > Eg > > External_file.txt > 1 good > 2 bad > 3 neutral > > Is there similar thing like #include <external_file.txt>, and the powershell > loads the value from external files ? the file and then do: .. .\External_file.ps1 |
My System Specs![]() |
| | #3 (permalink) |
| | Re: External File - Lookup Table Thanks it works. However for performance, which method is better ? a) calling a external file (but my main script is shorter) b) put my functions into main script (longer script without external file) "tojo2000" <tojo2000@xxxxxx> wrote in message news:df7275cd-fd92-4c42-8d32-2482f5ca97b7@xxxxxx On Oct 23, 10:26 pm, "IT Staff" <jkk...@xxxxxx> wrote: Quote: > In my script, i used a switch statement. > > Is there a way that the script points to a external file and get the > values > from external files ? > > Eg > > External_file.txt > 1 good > 2 bad > 3 neutral > > Is there similar thing like #include <external_file.txt>, and the > powershell > loads the value from external files ? the file and then do: .. .\External_file.ps1 |
My System Specs![]() |
| | #4 (permalink) |
| | Re: External File - Lookup Table On Oct 24, 12:33*am, "IT Staff" <jkk...@xxxxxx> wrote: Quote: > Thanks it works. However for performance, which method is better ? > > a) calling a external file (but my main script is shorter) > b) put my functions into main script (longer script without external file) > > "tojo2000" <tojo2...@xxxxxx> wrote in message > > news:df7275cd-fd92-4c42-8d32-2482f5ca97b7@xxxxxx > On Oct 23, 10:26 pm, "IT Staff" <jkk...@xxxxxx> wrote: > > > Quote: > > In my script, i used a switch statement. Quote: > > Is there a way that the script points to a external file and get the > > values > > from external files ? Quote: > > Eg Quote: > > External_file.txt > > 1 good > > 2 bad > > 3 neutral Quote: > > Is there similar thing like #include <external_file.txt>, and the > > powershell > > loads the value from external files ? > Are you creating this file? *Why not just create a switch statement in > the file and then do: > > . .\External_file.ps1 going to be importing this section of code from an external file, then I would wrap it in a function so that you only have to import it once. Generally it is helpful to import a script when the code will be reused, when you want to make it easier to change just that one section, or when it makes your main script more readable, but in general the difference in performance should be negligible. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Typed datasets and table table adapters components not showing inToolbox | .NET General | |||
| Export SQL Server table to text file | VB Script | |||
| HTA file - display data from DB records in table like ASP - how? | VB Script | |||
| Out-File after Format-Table via a filter | PowerShell | |||
| How do I read a XML file into a hash table? | PowerShell | |||