Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
0


I want to read a 2 of text file (Byte2.txt and FB.txt), but I dont want to put the path on the script, I want to use argument when I run the script from command line to parsing the path to my script. My expextation, when I run the script from command line :

$PowerShell.exe Script.ps1 arg1 arg2

arg1 represent the path of Byte.txt and arg2 represent the path of FB.txt

What I have tried:

<pre>
$file = $Args[0]
$Data = $Args [1]
$file_2 = Get-Content " "
$file_2
$Data_2 = Get-content " "
$Data_2

I execute that script from cmd :

$PS.exe Script.ps1 C:\User\Byte.txt C:\User\FB.txt
Posted
Updated 14-Dec-21 12:41pm
v4
Comments
Richard MacCutchan 11-Mar-19 5:16am    
And what happens?

1 solution

Write a program to list all the directories and the corresponding files, under these directories,
 
Share this answer
 
Comments
Richard Deeming 15-Dec-21 7:33am    
Your homework assignment is not a "solution" to someone else's question.

And if you were expecting someone to do the work for you, you're about to be sorely disappointed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900