I am asking path from user and getting powershell INPUT window is prompt when script is open in shell editor
but when I save this script as *.ps1 and right click->run with power shell then it is not showing input window, and suddenly disappears
how to get this INPUT window without opening script in editor
#declare paths
$sqlls = Read-Host
($sqlls -eq "quit");
$sqlls = $sqlls.Trim();
$lxl = "D:\sqlFileList12.xls"
#make a list
ls $sqlls -FILTER *.sql | foreach {$_.name} | OUT-File $lxl -force
$xl = New-Object -comobject Excel.Application
# Show Excel
$xl.visible = $true
$xl.DisplayAlerts = $False
# Create a workbook
$wb = $xl.Workbooks.open($lxl)
Do you use Windows 7 with PowerShell 3.0?
windows 7 and shell 2.0, I was fired command Get-Host
The recommended way to get a PowerShell version is to use $PSVersionTable automatic variable:
PS> $PSVersionTable
I'm confused that you have "Run with PowerShell" option on a context menu for .ps1 files. That feature is introduced in PowerShell 3.0, and it has a bug on Windows 7 computers.
More details: https://connect.microsoft.com/PowerShell/feedback/details/775161/run-with-powershell-feature-doesnt-work-on-windows-7
Thanks Aleksandar,
what can I do in this case for a bug, I can't download 3.0 as per company rule, one more thing I have other RDC have sql server 2008 R2 OS x but this code is not opening at all on this os, have no ISE editor, can I do it using CMD