One of these, I thought was academically interesting... and Hence, the PowerShell batch script.
Save this to a batch file : Test.bat
<#
Cls
copy %~dpn0.BAT %~dpn0.ps1
powershell.exe -Noprofile -ExecutionPolicy Unrestricted -file %~dpn0.ps1
::@Pause
@DEL %~dpn0.ps1
@GOTO :EOF
#>
("1+1="+(1+1))
Now the issue is that it is making a copy of itself.... but it will run.
- EDIT - Had an error at work, see http://import-powershell.blogspot.com/2012/02/another-ps1batch-approach.html
- EDIT - Had an error at work, see http://import-powershell.blogspot.com/2012/02/another-ps1batch-approach.html
No comments:
Post a Comment