LeveL Posted April 29, 2006 Share Posted April 29, 2006 (edited) I have a CMD file, lets call it "script.cmd"That is in a folder in program files, letscall that "Folder".I run this command from winnt.sif, you allknow where that file is ..............%PROGRAMFILES%\Folder\script.cmdAnd it will not work! I was annoyed hours ago, now I am just gonnascream or chuck my PC out of my window!NOTHING WORKS.Why are they called "batch files" if you can notrun one file from another? Aaaaah - use theCALL function? Nope - refuses to work......How the hell M$ managed to develop Windowswith this pathetic command language is beyond me.You know why my script is inside Program Filesand not in C:\install like everyone elses unattendedsetup and every other unattended setup I have donein the last 2 years?! Because, then I can't install theprogram that is in program files! Isn't that just beautiful!I have to have my entire unattended inside this ONE folderin Program Files, so as you can see, it is a JOKE to begin with,and its getting funnier and funnier as I go along here.This won't do it....CALL %PROGRAMFILES%\Folder\script.cmdThis wont work either....CALL%PROGRAMFILES%\Folder\script.cmdOr these after renaming to BAT...CALL %PROGRAMFILES%\Folder\script.batCALL%PROGRAMFILES%\Folder\script.batNo wonder the whole of the internet uses Unix. Edited April 29, 2006 by LeveL Link to comment Share on other sites More sharing options...
SiMoNsAyS Posted April 29, 2006 Share Posted April 29, 2006 what if you add quotes... Link to comment Share on other sites More sharing options...
LeveL Posted April 29, 2006 Author Share Posted April 29, 2006 (edited) If only it were that easy!I put this.....start "%PROGRAMFILES%\Folder\script.bat"pauseThe pause is just to see whats happening,when I do this I get another DOS windowwith the window title...C:\Program Files\Folder\script.batAnd the text, oooooh that famous text...C:\Documents and settings\Administrator\DesktopLike it is CD'ing to that DIR? Yes, I am currentlytrying to run this command from the Desktop andget it giving me a command window on the desktop!So lets get it straight... it is not doing what I am tellingit to do and at the same time, is doing something quiteuseful IN ANOTHER SITUATION but not this one It ALWAYS does this! I do not want a ******* console window on my Desktop!Anyone would think I typed........cd \%USERPROFILE%\DesktopBecause thats exactly what its doing, running anotherconsole window in the same place as the first, so it openson the desktop. It has always done this, for the 2 yearsI have used scripts and for the next 2 years by the look of it,believe me I have tried to sort this out before, its impossible. Why is it always ridiculous things that should take 5 seconds towork, you'd think, that take hours or even days to find an answerto?Nothing wrong with this.....%PROGRAMFILES%\Folder\Script.cmdBut it opens a console window on my desktop, how sweet!Shame when there is a script in Program Files I wanna runand that is precisely what I told it to do, but nevermind. When hasWindows ever done what you expect or tell it to do... I would getfurther with a pocket calculator Edited April 29, 2006 by LeveL Link to comment Share on other sites More sharing options...
LeveL Posted April 29, 2006 Author Share Posted April 29, 2006 (edited) Command: CALLDescription: The CALL command is used to run another batch filefrom within a batch file. Execution of the current batch file is pausedand the called batch file is run. After the called batch file has finishedrunning, the original batch file is resumed at the line after the CALLstatement.Note: If another batch file is run from within a batch file by simply usingits name, after the called batch file finishes executing, control is returnedto the Command Line, NOT the original batch file.Syntax: CALL batchfilename [parameters][switches]Typical Use: The CALL command is used to provide modularity to batch files.Batch files can be re-used effortlessly if they are written with modularity in mind.Example: IF %1 == A: CALL FLOPPY.BAT"Batch files can be re-used effortlessly" oh sure, gimme a break!Seems 1900 others are stuck too....."Cannot find C:\Program"EDIT: this works.......CALL "%ProgramFiles%\Folder\install.exe"But only because I managed to make an AutoIt exewith an NT command line contained within that!So thank you AutoIt2.... YOUR STUFF WORKS unlike Microsoft, which I gave up with. Edited April 29, 2006 by LeveL Link to comment Share on other sites More sharing options...
andrew84uk Posted April 29, 2006 Share Posted April 29, 2006 (edited) Microsoft stuff works if you no how to use it, which seems to me you don't START /Wait %SystemDrive%\Folder\BatchScript.cmd Edited April 29, 2006 by zen62619 Link to comment Share on other sites More sharing options...
Djé Posted April 29, 2006 Share Posted April 29, 2006 I have a CMD file, lets call it "script.cmd"That is in a folder in program files, lets call that "Folder".[humor]How to you want us to beleive you: nobody has a a script called "script.cmd" in folder called "Folder" That would be too simple![/humor]I run this command from winnt.sif[serious]What does it mean ??? From which directive in winnt.sif ? DetachedProgram ? GuiRunOnce ? SetupParams ?They all have different syntax and for example the 1st one cannot accept cmd files directly.Why don't you post better explanations so we can help further?[/serious]I was annoyed hours ago, now I am just gonnascream or chuck my PC out of my window![humor grade=half-serious]If you do, please post a picture here afterward! [/humor] Link to comment Share on other sites More sharing options...
Gee Posted April 29, 2006 Share Posted April 29, 2006 I am sure all of us can be more usefull if you send us a copy of your batch file.If it is a "Top Secret" batch file, put place holders where the programs should go. I am sure we can figure it out for you. Link to comment Share on other sites More sharing options...
cluberti Posted April 29, 2006 Share Posted April 29, 2006 On a side note, I would actually pay a few bucks to watch the computer toss . Link to comment Share on other sites More sharing options...
mc134 Posted April 29, 2006 Share Posted April 29, 2006 Try usingCALL c:\"Program Files"\Folder\install.exeorCALL c:\Progra~1\Folder\Install.exeI have a few scripts that totally refuse to run if I use %programfiles%even if i use the set command like this:SET Progs="C:\Program Files"or SET Progs=%Programfiles%CALL %Progs%\Folder\Install Link to comment Share on other sites More sharing options...
trickytwista Posted April 29, 2006 Share Posted April 29, 2006 On a side note, I would actually pay a few bucks to watch the computer toss .LMAO, ya that would be comical Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 29, 2006 Share Posted April 29, 2006 A VBS script would also work.This has a lot of comment line in it so you can read it as they are the instruction.'//--> VARIBLES FOR THE SCRIPT Dim Act, Fso, ProgramFile, MyCmd '//--> OBLECTS FOR THE SCRIPT Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject")'//--> VARIBLES AS OBJECTS'//--> YOU CAN USE EITHER THE TWO BELOW OBJECTS TO GET TO THE PROGRAM FILES FOLDER'//--> ProgramFile IF YOU USE THIS ONE THEN THE FULL PATH MUST LOOK LIKE MyCmd'//--> THIS IS HERE ProgramFile ONLY AS A DEMO, MyCmd IS COMMENTED OUT SO IS INACTIVE ProgramFile = Act.ExpandEnvironmentStrings("%ProgramFiles%") '//--> THIS IS A DEMO LINE AND IS SAFE TO DELETE '//--> THIS IS INACTIVE REMOVE THIS '''' TO TO MAKE ACTIVE'''' MyCmd = Act.ExpandEnvironmentStrings("%ProgramFiles%\Folder\BatchScript.cmd")'//--> OPTION CHECK FOR THE FOLDER, NOTE FOR EVERY IF YOU MUST HAVE A END IF If Fso.FolderExists(ProgramFile) Then '//--> THIS IS A DEMO LINE AND IS SAFE TO DELETE '//--> THIS IS INACTIVE REMOVE THIS '''' BEFOR If Fso.FileExists(MyCmd) THE TO TO MAKE ACTIVE'''' If Fso.FileExists(MyCmd) Then Act.Popup ProgramFile & ", exists",30, "Confirm", 0 + 32'//--> DEPENDING ON WAHT VARIBLE AS OBJECT YOU USE EITHER LINE WILL WORK'//--> chr(34) ACT LIKE A DOUBLE QUOTE FOR PATHWAYS THAT HAVE SPACES.'//--> THIS LINE WHEN ACTIVE SHOW THE CMD WINDOW, THE TRUE FORCES IT TO WAIT AND FINISH'''' Act.Run(chr(34) & ProgramFile & "\Folder\BatchScript.cmd" & chr(34)),1,True '//--> THIS LINE WHEN ACTIVE HIDES THE CMD WINDOW, THE TRUE FORCES IT TO WAIT AND FINISH'''' Act.Run(chr(34) & MyCmd & chr(34)), 0, True Else Act.Popup "Missing, " & ProgramFile, 30, "Missing", 0 + 32 End IfIf using ProgramFile as VARIBLE as OBJECT, cmd window set to hiddenDim Act, Fso, ProgramFile Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") ProgramFile = Act.ExpandEnvironmentStrings("%ProgramFiles%\Folder\BatchScript.cmd") If Fso.FileExists(ProgramFile) Then Act.Run(chr(34) & ProgramFile & chr(34)), 0, True Else Act.Popup "Missing, " & ProgramFile, 30, "Missing", 0 + 32 End IfIf using MyCmd as VARIBLE as OBJECT, cmd window set to hidden Dim Act, Fso, MyCmd Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") MyCmd = Act.ExpandEnvironmentStrings("%ProgramFiles%\Folder\BatchScript.cmd") If Fso.FileExists(MyCmd) Then Act.Run(chr(34) & MyCmd & chr(34)), 0, True Else Act.Popup "Missing, " & MyCmd, 30, "Missing", 0 + 32 End If Link to comment Share on other sites More sharing options...
Djé Posted May 2, 2006 Share Posted May 2, 2006 He must have done it... Link to comment Share on other sites More sharing options...
LeveL Posted May 11, 2006 Author Share Posted May 11, 2006 He must have done it...I did do it somehow and it was the CALLfunction that was needed after all.Last line of WINNT.SIF says...CALL "%PROGRAMFILES%\bbLean\start.cmd"EXITHmmmmm, actually thats the last line of NLITE.CM_which is really what WINNT.SIF points to at the end, its complicated but, possible in the end. B) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now