Jump to content

Gonna throw this machine out of the window in a minute!


Recommended Posts

I have a CMD file, lets call it "script.cmd"

That is in a folder in program files, lets

call that "Folder".

I run this command from winnt.sif, you all

know where that file is ;) ..............

%PROGRAMFILES%\Folder\script.cmd

And it will not work!

I was annoyed hours ago, now I am just gonna

scream or chuck my PC out of my window!

NOTHING WORKS.

Why are they called "batch files" if you can not

run one file from another? Aaaaah - use the

CALL function? Nope - refuses to work......

How the hell M$ managed to develop Windows

with this pathetic command language is beyond me.

You know why my script is inside Program Files

and not in C:\install like everyone elses unattended

setup and every other unattended setup I have done

in the last 2 years?! Because, then I can't install the

program that is in program files! Isn't that just beautiful!

I have to have my entire unattended inside this ONE folder

in 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.cmd

This wont work either....

CALL%PROGRAMFILES%\Folder\script.cmd

Or these after renaming to BAT...

CALL %PROGRAMFILES%\Folder\script.bat

CALL%PROGRAMFILES%\Folder\script.bat

No wonder the whole of the internet uses Unix.

Edited by LeveL
Link to comment
Share on other sites


If only it were that easy!

I put this.....

start "%PROGRAMFILES%\Folder\script.bat"

pause

The pause is just to see whats happening,

when I do this I get another DOS window

with the window title...

C:\Program Files\Folder\script.bat

And the text, oooooh that famous text...

C:\Documents and settings\Administrator\Desktop

Like it is CD'ing to that DIR? Yes, I am currently

trying to run this command from the Desktop and

get it giving me a command window on the desktop!

So lets get it straight... it is not doing what I am telling

it to do and at the same time, is doing something quite

useful IN ANOTHER SITUATION but not this one :(

It ALWAYS does this! :realmad:

I do not want a ******* console window on my Desktop!

Anyone would think I typed........

cd \%USERPROFILE%\Desktop

Because thats exactly what its doing, running another

console window in the same place as the first, so it opens

on the desktop. It has always done this, for the 2 years

I 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 to

work, you'd think, that take hours or even days to find an answer

to?

Nothing wrong with this.....

%PROGRAMFILES%\Folder\Script.cmd

But it opens a console window on my desktop, how sweet!

Shame when there is a script in Program Files I wanna run

and that is precisely what I told it to do, but nevermind. When has

Windows ever done what you expect or tell it to do... I would get

further with a pocket calculator :angry:

Edited by LeveL
Link to comment
Share on other sites

Command: CALL

Description: The CALL command is used to run another batch file

from within a batch file. Execution of the current batch file is paused

and the called batch file is run. After the called batch file has finished

running, the original batch file is resumed at the line after the CALL

statement.

Note: If another batch file is run from within a batch file by simply using

its name, after the called batch file finishes executing, control is returned

to 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 exe

with an NT command line contained within that!

So thank you AutoIt2.... YOUR STUFF WORKS unlike Microsoft, which I gave up with.

Edited by LeveL
Link to comment
Share on other sites

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" :P

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 gonna

scream or chuck my PC out of my window!

[humor grade=half-serious]

If you do, please post a picture here afterward! :P

[/humor]

Link to comment
Share on other sites

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

Try using

CALL c:\"Program Files"\Folder\install.exe

or

CALL c:\Progra~1\Folder\Install.exe

I 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

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 If

If using ProgramFile as VARIBLE as OBJECT, cmd window set to hidden

Dim 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 If

If 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

  • 2 weeks later...
He must have done it...

I did do it somehow and it was the CALL

function that was needed after all.

Last line of WINNT.SIF says...

CALL "%PROGRAMFILES%\bbLean\start.cmd"
EXIT

Hmmmmm, 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...