get-content inside a script


hi have basic question get-content inside script...

for example have next script:

param($input)

 gc  (gci $input ).fullname

 

if past code in console don't have problem, in script have following error:

get-content : cannot bind argument parameter 'path' because null.

at line:1 char:3

+ gc <<<<  $as

    + categoryinfo          : invaliddata: (:) [get-content], parameterbinding 

   validationexception

    + fullyqualifiederrorid : parameterargumentvalidationerrornullnotallowed,m 

   icrosoft.powershell.commands.getcontentcommand

 

what problem?

$input special variable in powershell, bad idea give own variable same name.  see get-help about_automatic_variables more info on $input is.

this issue - try renaming paramter different $filepath , see if starts working.

thanks,

-lincoln



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2