Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: What is wrong with this command line?

18 Aug 2014   #1

Windows7 32bit
What is wrong with this command line?

Help please I am pulling my hair out.

I use a desktop shortcut to run an application called get_iplayer.cmd located in the directory c:\program files\get_iplayer

The line in the Target of the shortcut properties therefore reads:

C:\Windows\System32\cmd.exe /k "c:\program files\get_iplayer\get_iplayer.cmd"

When the shortcut is run (as administrator) the following lines are returned:

'c:\program' is not a recognized internal or external command, operable program or batch file

However if I repeat the command again by running cmd and use CD to get to manually change directories the program runs as expected.

What is going wrong?

My System SpecsSystem Spec
19 Aug 2014   #2

Windows 7 32 bit

This is the dreaded space in the filename issue. When you run a command with spaces in the path you must double up the double quotes as shown in the example
"Spaces in Program Path:"
CMD.exe (Command Shell) | Windows CMD |
My System SpecsSystem Spec
19 Aug 2014   #3

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1

C:\Windows\System32\cmd.exe /k ""c:\program files\get_iplayer\get_iplayer.cmd""
My System SpecsSystem Spec

19 Aug 2014   #4

Windows7 32bit

Sorry but I just get a label syntax error with the double ""
My System SpecsSystem Spec
19 Aug 2014   #5

Windows7 32bit

actually i was wrong i now get

' "c:\program files\get_iplayer\get_iplayer.cmd' " is not recognised as an internal or external command ...blaa.. blaa..
My System SpecsSystem Spec
20 Aug 2014   #6

Windows 7 32 bit

How about let the shell do it? Right click in the folder where the .cmd file is, New Shortcut, choose the .cmd file as target. Then if it works you should be able to drag the shortcut to the desktop or wherever and have it still function.

Edit: Or do it another way. Right click your shortcut on the desktop and click Properties. Fill in the "Start in:" field with the folder where the .cmd file is. Since program files has a space you may need to wrap it in double quotes. But this method should be more reliable.
My System SpecsSystem Spec
20 Aug 2014   #7

x64 (6.3.9600) Win8.1 Pro & soon dual boot x64 (6.1.7601) Win7_SP1 HomePrem

Use the environment variable, ProgramFiles

C:\Windows\System32\cmd.exe /k %ProgramFiles%\get_iplayer\get_iplayer.cmd
My System SpecsSystem Spec

 What is wrong with this command line?

Thread Tools

Similar help and support threads
Thread Forum
I'm in the wrong line of work
Matt Haag is a video gamer. He makes $1 million a year. | Tampa Bay Times This guys makes 1 million playing games
Command Line - Help
Hi Guy's and Girls, Just first off I've never been too good with CMD and only an Apprentice in my company I work for. Now something I've wanted to do for awhile was to make the following but I don't necassirealy I know how to do this in one batch file: I would need a Batch file that is...
General Discussion
Command line csc not working.
I am trying to use csc.exe from the command prompt to run a program called c:\code\helloworld.cs. I know the program works as I tested it using 'compile online dot com'. When I run csc, I get the following error (see jpg). How may I solve this problem, please? When I set the 'Path' to the...
General Discussion
How can I set this via command-line or registry?
How can I set this via command-line or registry? I need a way to automatically launch "Explorer c:\folder\myfolder" with a view appropriate for long filenames on any Windows Vista/Win7 PC.
libraries and the command line
I am a long time programmer and computer science professor, since 1979. I grew up with the command line and like it just fine. But Windows 7 seems to change the GUI way of doing things and not mess with the command line. Yesterday I was at the command prompt and went to C:\users\Stockwell and...
Performance & Maintenance
Command Line
Is there a cmd.exe /switch for “run as administrator” ? Thanks-
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 05:32.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App