Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Code injected into my powershell script.

$
0
0

I have a short powershell script which I copy/paste from Notepad into the Windows Powershell(4) tool Version 2.0. When the script is pasted, mysterious junk appears appended to one of the lines:

Coded line:

$TodaysArchive = $ArchiveDir + $Today.tostring();

Line as pasted into powershell:

$TodaysArchive = $ArchiveDir + $Today.tostring();    .\Favorites

Error returned by powershell when the script is run:

 The term '.\Favorites' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
 spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:62
+ $TodaysArchive = $ArchiveDir + $Today.tostring(); .\Favorites <<<<
    + CategoryInfo          : ObjectNotFound: (.\Favorites:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Note the ".\Favorites" is not in the original code, and only appears when pasted into Powershell.  It does not appear when pasted into another Notepad session.  This is a real drag. 

Any helpful comments?  I have no control over the version of PS.

Thanks,

Michael


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>