Jump to content

Various questions about the PowerShell

I admit I'm late to the game.

 

Having used COMMAND.COM, later cmd, since the mid-90s, I feel quite confident using it, not really missing anything. Over the next two decades I extended cmd with wrappers like ConEmu and PyCmd, but it still was cmd under the hood. I gave Microsoft's Monad experiment (later, PowerShell) a try and I did not really like it as I failed to see the advantages for my use cases, so I somehow lost track of it.

 

However, a couple of days ago PyCmd repeatedly crashed, so I was looking for a new, less annoying alternative again. While trying some of the possible alternatives (minus the standard-defying atrocities of Cygwin et al.), I found out that the PowerShell has been improved a lot, especially when used inside ConEmu (which natively supports it quite well). While trying it side-by-side with the Hamilton C shell (hcsh from now on), I found a number of things I still don't like though. Maybe some of you can help me with this?

  • Is there a way to remove the need to type .\ before anything that happens in the current directory? E.g. I'm in a folder containing a dostuff.cmd file and the PowerShell forces me to write .\dostuff.cmd instead of dostuff.cmd which was no problem with cmd.
  • Every time I start the PowerShell, it will tell me how long it took to read and execute my configuration file. Can I disable that?
  • Is there a way to generally make the PowerShell start faster? I don't have the newest machine but I'd still prefer to not have to wait a number of seconds before I can type commands.

Bonus question for those who tried both: Is there anything the PowerShell does better than the hcsh (except being free)?

(edit: the latter does not use colors which is, admittedly, a loss.)

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, Dat Guy said:

Is there a way to remove the need to type .\ before anything that happens in the current directory? E.g. I'm in a folder containing a dostuff.cmd file and the PowerShell forces me to write .\dostuff.cmd instead of dostuff.cmd which was no problem with cmd.

The ".\" denotes that it is to be run from the local folder. If you don't want to use ".\" then it has to be in the ENVIRONMENT path.

6 hours ago, Dat Guy said:
  • Every time I start the PowerShell, it will tell me how long it took to read and execute my configuration file. Can I disable that?

I haven't used a PowerShell terminal thats done this by default. Is this a specific script that you're running?

Does it include Measure-Command or a StopWatch function?

 

Heres a basic ping script I wrote - no verbose execution times.

 

n0kqinua.v4q.png

 

6 hours ago, Dat Guy said:
  • Is there a way to generally make the PowerShell start faster? I don't have the newest machine but I'd still prefer to not have to wait a number of seconds before I can type commands.

Powershell is instant just like cmd. Perhaps you have timers in your script?

 

6 hours ago, Dat Guy said:

Bonus question for those who tried both: Is there anything the PowerShell does better than the hcsh (except being free)?

Ive never used/heard of hcsh

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | EVGA GTX1070 FTW | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO | 12 x 8TB HGST Ultrastar He10 (WD Whitelabel) | 500GB Aorus Gen4 NVMe | 2 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Jarsky said:

The ".\" denotes that it is to be run from the local folder. If you don't want to use ".\" then it has to be in the ENVIRONMENT path.

 

Is there a way to simulate cmd behavior for this?

 

2 minutes ago, Jarsky said:

I haven't used a PowerShell terminal thats done this by default. Is this a specific script that you're running?

 

Hmm, not sure. Everything that's in my Profile file (Microsoft.PowerShell_profile.ps1, the other one does not even exist here) is the default Chocolatey script. :|

Commenting everything out does not solve the issue, it still loads notably slow and tells me how long it took.

 

2 minutes ago, Jarsky said:

Powershell is instant just like cmd. Perhaps you have timers in your script?

 

Not that I knew.

 

2 minutes ago, Jarsky said:

Ive never used/heard of hcsh

 

Don't worry, I just thought someone here would. :)

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dat Guy said:

 

Is there a way to simulate cmd behavior for this?

 

Not that i'm aware of - other than putting the scripts in a folder thats in your ENV PATH e.g C:\Windows\System32 or you could add something like D:\Scripts to your ENV PATH and put the scripts in there.

1 minute ago, Dat Guy said:

 

Hmm, not sure. Everything that's in my Profile file (Microsoft.PowerShell_profile.ps1, the other one does not even exist here) is the default Chocolatey script. :|

Commenting everything out does not solve the issue, it still loads notably slow and tells me how long it took.

 

Sounds like a Chocolatey thing? I thought choco shows execution times? (im not at home to test choco right now)

 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | EVGA GTX1070 FTW | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO | 12 x 8TB HGST Ultrastar He10 (WD Whitelabel) | 500GB Aorus Gen4 NVMe | 2 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Jarsky said:

Not that i'm aware of - other than putting the scripts in a folder thats in your ENV PATH

 

That sucks. :( But thank you.

 

2 minutes ago, Jarsky said:

Sounds like a Chocolatey thing?

 

Maybe, but even after commenting out the Chocolatey things in the Profile file nothing changes.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×