Windows shortcut, Command Line and Perl





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I developed several scripts using the command line in windows (which is needed because there are several 'say' comments that need to be shown) and using the line:



perl "D:/path to script"


That's all fine. But ...



This morning I created a series of shortcuts on Windows, the basic idea being they can click on the icon, and the CMD will open and start running the script. THAT is where I'm stuck !



In the target attribute of the shortcut, I have put:



C:/system32/cmd.exe D:/path to perl script


That opens the command line, and sets the prompt to "D:/path to script_" (I also tried adding perl in between the two arguemennts as per when typing directly into window. That had no effect) I tried "perl D:/path to script" in quotes. That didn't work



I then wondered about batch files, but they appears to close the window once batch has run, so won't be able to display the say commands!



I have also heard of "pl2bat", but no idea if that would keep the CLI alive whilst rest of program run.



This is running client side, and NOT in browser, or sending data to a server, the idea being with Perl on a USB stick, it will be 'self contained' with nothing being installed on PC










share|improve this question























  • Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

    – JosefZ
    Mar 10 at 11:49











  • What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

    – Cristofayre
    Mar 10 at 14:31


















0















I developed several scripts using the command line in windows (which is needed because there are several 'say' comments that need to be shown) and using the line:



perl "D:/path to script"


That's all fine. But ...



This morning I created a series of shortcuts on Windows, the basic idea being they can click on the icon, and the CMD will open and start running the script. THAT is where I'm stuck !



In the target attribute of the shortcut, I have put:



C:/system32/cmd.exe D:/path to perl script


That opens the command line, and sets the prompt to "D:/path to script_" (I also tried adding perl in between the two arguemennts as per when typing directly into window. That had no effect) I tried "perl D:/path to script" in quotes. That didn't work



I then wondered about batch files, but they appears to close the window once batch has run, so won't be able to display the say commands!



I have also heard of "pl2bat", but no idea if that would keep the CLI alive whilst rest of program run.



This is running client side, and NOT in browser, or sending data to a server, the idea being with Perl on a USB stick, it will be 'self contained' with nothing being installed on PC










share|improve this question























  • Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

    – JosefZ
    Mar 10 at 11:49











  • What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

    – Cristofayre
    Mar 10 at 14:31














0












0








0








I developed several scripts using the command line in windows (which is needed because there are several 'say' comments that need to be shown) and using the line:



perl "D:/path to script"


That's all fine. But ...



This morning I created a series of shortcuts on Windows, the basic idea being they can click on the icon, and the CMD will open and start running the script. THAT is where I'm stuck !



In the target attribute of the shortcut, I have put:



C:/system32/cmd.exe D:/path to perl script


That opens the command line, and sets the prompt to "D:/path to script_" (I also tried adding perl in between the two arguemennts as per when typing directly into window. That had no effect) I tried "perl D:/path to script" in quotes. That didn't work



I then wondered about batch files, but they appears to close the window once batch has run, so won't be able to display the say commands!



I have also heard of "pl2bat", but no idea if that would keep the CLI alive whilst rest of program run.



This is running client side, and NOT in browser, or sending data to a server, the idea being with Perl on a USB stick, it will be 'self contained' with nothing being installed on PC










share|improve this question














I developed several scripts using the command line in windows (which is needed because there are several 'say' comments that need to be shown) and using the line:



perl "D:/path to script"


That's all fine. But ...



This morning I created a series of shortcuts on Windows, the basic idea being they can click on the icon, and the CMD will open and start running the script. THAT is where I'm stuck !



In the target attribute of the shortcut, I have put:



C:/system32/cmd.exe D:/path to perl script


That opens the command line, and sets the prompt to "D:/path to script_" (I also tried adding perl in between the two arguemennts as per when typing directly into window. That had no effect) I tried "perl D:/path to script" in quotes. That didn't work



I then wondered about batch files, but they appears to close the window once batch has run, so won't be able to display the say commands!



I have also heard of "pl2bat", but no idea if that would keep the CLI alive whilst rest of program run.



This is running client side, and NOT in browser, or sending data to a server, the idea being with Perl on a USB stick, it will be 'self contained' with nothing being installed on PC







windows command-line shortcuts perl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 10 at 11:18









CristofayreCristofayre

14




14













  • Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

    – JosefZ
    Mar 10 at 11:49











  • What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

    – Cristofayre
    Mar 10 at 14:31



















  • Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

    – JosefZ
    Mar 10 at 11:49











  • What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

    – Cristofayre
    Mar 10 at 14:31

















Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

– JosefZ
Mar 10 at 11:49





Try entering target command of a shortcut in an open cmd window. Then you could view result/error message(s) immediately after pressing the <Enter> key.

– JosefZ
Mar 10 at 11:49













What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

– Cristofayre
Mar 10 at 14:31





What I've got so far using the shortcut is Target CMD.exe, Open in "D:...." That does as expected, and opens the command line with D path to script ... but still no execution

– Cristofayre
Mar 10 at 14:31










1 Answer
1






active

oldest

votes


















0














You should be able to do this with a standard .BAT file containing the perl script. To preserve the CMD window put the pause command after the perl script.




D:/path to perl script



pause







share|improve this answer
























  • Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

    – Cristofayre
    Mar 10 at 14:35











  • Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

    – John Damm Sørensen
    Mar 10 at 14:54











  • Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

    – Cristofayre
    Mar 13 at 11:19











  • Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

    – Cristofayre
    Mar 30 at 14:16












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412806%2fwindows-shortcut-command-line-and-perl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You should be able to do this with a standard .BAT file containing the perl script. To preserve the CMD window put the pause command after the perl script.




D:/path to perl script



pause







share|improve this answer
























  • Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

    – Cristofayre
    Mar 10 at 14:35











  • Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

    – John Damm Sørensen
    Mar 10 at 14:54











  • Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

    – Cristofayre
    Mar 13 at 11:19











  • Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

    – Cristofayre
    Mar 30 at 14:16
















0














You should be able to do this with a standard .BAT file containing the perl script. To preserve the CMD window put the pause command after the perl script.




D:/path to perl script



pause







share|improve this answer
























  • Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

    – Cristofayre
    Mar 10 at 14:35











  • Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

    – John Damm Sørensen
    Mar 10 at 14:54











  • Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

    – Cristofayre
    Mar 13 at 11:19











  • Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

    – Cristofayre
    Mar 30 at 14:16














0












0








0







You should be able to do this with a standard .BAT file containing the perl script. To preserve the CMD window put the pause command after the perl script.




D:/path to perl script



pause







share|improve this answer













You should be able to do this with a standard .BAT file containing the perl script. To preserve the CMD window put the pause command after the perl script.




D:/path to perl script



pause








share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 10 at 14:05









John Damm SørensenJohn Damm Sørensen

12




12













  • Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

    – Cristofayre
    Mar 10 at 14:35











  • Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

    – John Damm Sørensen
    Mar 10 at 14:54











  • Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

    – Cristofayre
    Mar 13 at 11:19











  • Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

    – Cristofayre
    Mar 30 at 14:16



















  • Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

    – Cristofayre
    Mar 10 at 14:35











  • Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

    – John Damm Sørensen
    Mar 10 at 14:54











  • Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

    – Cristofayre
    Mar 13 at 11:19











  • Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

    – Cristofayre
    Mar 30 at 14:16

















Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

– Cristofayre
Mar 10 at 14:35





Forgive my ignorance, John. So the bat file is simply a txt file listing the script path, and pause at end to stop if from closing. But how do I link to that from the shortcut as the "Start in" will only take a folder name. Do I need to modify the line that calls "...cmd.exe" Or is that line itself the call to the batch file? (Have managed to find that you can start the CMD to a specific size from shortcut, so that's a help !)

– Cristofayre
Mar 10 at 14:35













Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

– John Damm Sørensen
Mar 10 at 14:54





Exactly. Simply create a shortcut for the .BAT file. The cmd.exe is implied by the file type. So I don't think you need to worry. I think examining the properties of the shortcut (not the .BAT file) will give you what you need.

– John Damm Sørensen
Mar 10 at 14:54













Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

– Cristofayre
Mar 13 at 11:19





Sorry for delay in getting back to you; been working on another program, (this one to allow event photographers to hand people a card that sends client to their personal folder on host) Got the admin side done, now got to work on perl / API2 side of things. On the bat side of things, I will -h -s the folder with perl / scripts so they only access the bat files to run things

– Cristofayre
Mar 13 at 11:19













Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

– Cristofayre
Mar 30 at 14:16





Oh dear ... copy and pasting / moving,did something wrong and now allthe icons have gone.and none of the files work. (Can run the script by entering target in CMD target ... but batch file. (Somewhere someone suggested "%~d0" so batch ran 'drive indepedent') Just realised CMD target starts with a drive letter. If I copy that to another machine with less partitions, that letter will be wrong.So what to do? (Back to "Square One" !!)

– Cristofayre
Mar 30 at 14:16


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412806%2fwindows-shortcut-command-line-and-perl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix