Answer the question
In order to leave comments, you need to log in
Launching powershell with commands using a shortcut?
With what content should I create a bat file (or something like that) that opens a PowerShell console, changes the current folder, and executes a command there? (git pull origin master)? And leave the console open
Answer the question
In order to leave comments, you need to log in
You can create a shortcut, specify the launch of Powershell and the script in it in this way
powershell.exe -NoExit -command "C:\Temp\test.ps1"
in the first line of the script, you can change the current folder to the
set-location "c:\" you need Temp"
Next, the command you need
git
pull origin master
at startup, the -NoExit key is specified
If you need to run some command, then insert the following line into the shortcut:
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command "stop-vm -name vm-teamviewer;start-sleep -seconds 10;start- vm -name vm-teamviewer"
If you want the window to remain:
powershell.exe -ExecutionPolicy Bypass -NoExit -Command "stop-vm -name vm-teamviewer;start-sleep -seconds 10;start-vm -name vm-teamviewer"
If you need to execute a script:
powershell -ExecutionPolicy Bypass -file "D:\OneDrive\ScriptingGuy\powershell\create-new-vm-wizard.ps1"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question