Fairly new to scripting. I have a very basic script which works fine within the ISE but when I run it within a file it doesn't. Script:
#
# WPM Convert to Ascii.ps1
# Process to remove accented characters from a text file as they cause issues when importing to U4BW via GL07
# SP Jan 2019
#
# Parameters
#
$usefile =$dir+"\"+'SPTEMP.txt'
$outfile =$dir+"\"+'SPOUT.txt'
#
# Convert characters
#
Get-Content $usefile -replace 'a', 'A' |Set-Content $outfile
Simply converting characters in 1 file outputting to another. Called from U4BW(Agresso) command being:-
powershell.exe -ExecutionPolicy Unrestricted -File "c:\scripts\WPM Convert to Ascii.ps1" -infile "[File name]" -dir "[Directory]"
I have debugged all the parameters sent (infile and dir) and they are fine. Tried closing the file (outfile) beforehand.
I know this is probably a basic issue but I just can't see it. Any help gratefully received! Steve
-infileparameter for? It is never used.