Reputation: 603
I can make a customized command prompt shortcut on my desktop to start in a particular directory and have some specified dimensions etc.
Now i have a script that sets some environment variables for the prompt and want to run it as soon as this shortcut is clicked.
How do i tell cmd or powershell to run this script in the current shell window and then show the shell ?
Upvotes: 0
Views: 2881
Reputation: 200233
For cmd
change the shortcut target to
%COMSPEC% /k C:\PATH\TO\your.cmd
and set the environment variables in your.cmd
:
@echo off
set FOO=23
set BAR=42
Upvotes: 1
Reputation: 54881
Change the properties of the shortcut to include the file
(scriptpath) and the noexit
(to not close when done) parameter in the target-path. Example for target-path:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -file "c:\users\graimer\desktop\testscript.ps1"
Upvotes: 1