You are not logged in.

#1 16 Jun 2014 02:04

strykerChaos
New Member
Registered: 16 Jun 2014
Posts: 2

Command Prompt shortcut

Hello I am 100% new to command prompt so I am asking for a little guidance.

I am lost on part two I simply have no idea what it is asking, do you? I know the /K keeps the command prompt window open after the script is finished. But thats about it.

1·  Create a new Windows shell initialization script that automatically adds to the path variable the name and path of the folder where you plan to store your Windows shell scripts.

the script bellow is saved in C:\scripts\PathMod.bat

**********************

@ECHO off

PATH C:\scripts;%path%

***********************


2·  Create a new Command Prompt shortcut and configure it to automatically execute your new Windows shell initialization script. Hint: Use the /K switch and specify the complete path of the folder where the scripts reside.

I know I can create a short cut for the command prompt and have it start in C:\scripts but I have no idea how to use the /k switch to execute the shell initialization script.

From what I understand the \k simply keeps the window open after the script is executed. Other than that I am lost can some one please help me understand this better.

Offline

#2 16 Jun 2014 03:47

strykerChaos
New Member
Registered: 16 Jun 2014
Posts: 2

Re: Command Prompt shortcut

I think I have figured out how to do it by modifying the short cut's target: C:\Windows\System32\cmd.exe cmd /K C:\Scripts\PathMod.bat

I am not sure it is correctly done but it works.

I added the      cmd /K C:\Scripts\PathMod.bat      to the target.

Offline

#3 16 Jun 2014 09:15

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Command Prompt shortcut

Here's a way to use it in a batch file.  %comspec% is a variable that holds the path and name of the cmd processor.

@echo off
"%comspec%" /k "c:\scripts\pathmod.bat"

Offline

Board footer

Powered by