Use Unix shell script to open Windows command prompt (cmd)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Use Unix shell script to open Windows command prompt (cmd)
# 8  
Old 08-17-2011
Hello guys, I have been able to open the command prompt (actually COMMAND.COM) from a shell script.
I have used the following piece of code. It is quite amazing, but it does open command.com. To say frankly I don't know how it works. Perhaps you guys do know it.

Code:
echo ^[[17xC:\\COMMAND.COM

As you can see I had to copy COMMAND.COM in the C: directory because when calling it from its original location C:\WINDOWS\system32\COMMAND.COM I get an error message "Access denied". Do you guys have an idea why this is so?

The problem I'm having now is that I am not able to pass a file (+ an argument) as parameter. Error: Too many parameters.

I tried the following:
Code:
echo ^[[17xC:\\COMMAND.COM "C:\myfile\fileparam.dat" "param1"

HELP please!
# 9  
Old 08-17-2011
why dont you use a batch file to get the file from unix serve ( ftp script )
# 10  
Old 08-17-2011
As previously explained, I have to initiate the call from a Unix program. Only when a user activates a button should the file transfer occur.
# 11  
Old 08-17-2011
user click button --> file download happens --> file downloaded to user desktop

1) where is the button available ? ( is it a web page ? -- hosted in unix machine ? )
2) Is file download should happen from unix machine ?
3) User is on the windows machine ?
# 12  
Old 08-17-2011
1) Yes the application is hosted on a Unix machine. The interface is DOS-like. When user presses function key F11, file should be downloaded.
2) Yes the file should be downloaded from the Unix machine onto the user Windows machine, in a specific directory.
3) Yes the user has a Windows machine
# 13  
Old 08-17-2011
Seriously? You're logged into a Unix server, and some echo command opens a command prompt on your windows machine. I'd like more information.

The only way to get a file from Unix to windows is to use one of the available protocols. You need to pick one of these, for example:
ftp
ssh/sftp/scp
samba/smb

Those are protocols that will transfer files between computers.

I can't help but think you are way off base on finding a solution.

Please pick a protocol and post your Unix program. Then we should be able to help.
# 14  
Old 08-18-2011
Yes it does open the command prompt. As I said it is like magical. I don't know how it works, I have used some existing piece of code and it does the trick. But now I have to pass a file as parameter but it is not working?

Most probably the magic lies within the "^[[17x" part. But sincerely I don't know how it actually works.

Below is part of the piece of code, showing what I am trying to do.

Firstly I'm echoing some commands in a text file and then transfer that file on my local pc using kermit.
Secondly, I am supposed to call command.com with a file parameter so as to do some deletion in a specific directory. (not working presently since it is not accepting the file as a parameter)
Lastly, use winscp.com to download the file from Unix onto my Windows machine.

Code:
echo "
option batch on
option confirm off
open $LOGNAME:$PASNAME@$ADR_INT
option transfer binary
get $CFILE C:\\GLWIN\\myfiles\\$FILEPC
close
exit
" > myfile.txt

kermit -s myfile.txt

echo ^[[17xC:\\COMMAND.COM "C:\myfile\fileparam.dat" "param1"
echo ^[[7xD:\\winscp434\\winscp.com /console /script="C:\GLWIN\myfiles\myfile.txt"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies

2. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

3. Shell Programming and Scripting

how to change unix cmd display prompt?

I am new to to unix and I want to make my own basic shell. What is the code I can use to change the unix cmd console display? For example my unix display prompt says MyCompterName~, I want it to say WhatEverMan~ (3 Replies)
Discussion started by: megaearth77
3 Replies

4. Windows & DOS: Issues & Discussions

script to open new cmd prompt for devices on visio

Hello, Can any one please help: I have a lab design on Visio, with routers and switches. What I am planning to do is: when I double click a device icon - it should open a new cmd prompt window and automatically performs the telnet session and log's me into the device. Appreciate your... (0 Replies)
Discussion started by: sureshcisco
0 Replies

5. Shell Programming and Scripting

MKS KORN SHELL WONT EXECUTE from windows command prompt

Can anybody help me with this small script , the script works fine and launches the IE from c:\documents and settings \test\my documents>ksh prompt $RunURL1.sh this scitpt works and launches the ie from ksh , but when i schedule it to run the script then i get the error box saying command:1... (2 Replies)
Discussion started by: venu
2 Replies

6. Homework & Coursework Questions

Unix Shell Script to prompt customer for name etc

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: How do I create a shell script called 'custinfo' to prompt a customer to enter and display back the following:... (4 Replies)
Discussion started by: SQLScript
4 Replies

7. Shell Programming and Scripting

Unix cmd prompt how to get old cmd run?

Hi, I am using SunOS I want to serch my previous command from unix prompt (like on AIX we can search by ESC -k) how to get in SunOs urgent help require. (10 Replies)
Discussion started by: RahulJoshi
10 Replies

8. Shell Programming and Scripting

open terminal to run cmd using shell script

i want the shell script to open the terminal and in that terminal i want to run a command specified in the script... how can it be done... (2 Replies)
Discussion started by: chandrabhushan
2 Replies

9. UNIX for Dummies Questions & Answers

running command prompt executable file in shell script

hi i have file extentioned with test.vbs. i am able to run this file n execute through command promt but i dont know how to run in shell script example: file name is test.vbs which contains strSoundFile = "C:\windows\Media\Notify.wav" Set objShell = CreateObject("Wscript.Shell") strCommand... (5 Replies)
Discussion started by: atl@mav
5 Replies

10. Shell Programming and Scripting

Interaction shell cmd prompt

hi , how do i interact with the shell prompt. i need no. of args to be dynamic e.g $> type the no of args: <input from keyboard> Enter the 1 st arg : <input from keyboard> Enter the 2nd arg : <input from keyboard> ......... ......... let me know how to do it ... (1 Reply)
Discussion started by: adityamahi
1 Replies
Login or Register to Ask a Question